NewYour coding agent can read the release notes before it upgrades.Set up the MCP server β
Packagist
Packagist, #1372 most downloaded on Packagist
Programmatically edit PHP and Laravel files.
Latest stable
v2.1.0
Last release 26 days ago
27 Oct 2026
Ships unpredictably
gaps range from 2 weeks to 2.3 years
Some releases are documented
notes for 23 of 42 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
42 releases Β· first in 2020
Drag across the ruler to compare, or tap a release to open it.
PHP 8.5 support, tested in CI against Laravel 12 and 13. The suite passes unmodified on PHP 8.5.12, the current security release.
|>, (void) casts, final promoted properties, #[\NoDiscard].nikic/php-parser ^5.6 (was ^5.0), because 5.5 and older cannot parse PHP 8.5 syntax. Composer upgrades php-parser within 5.x, and nothing changes in your own code.No API changes. Full changelog: CHANGELOG.md Β· #91
No API changes, but the php-parser floor rises.
|>, (void) casts,
final promoted properties, #[\NoDiscard]) can be loaded, edited and
rendered. A round-trip test covers this.nikic/php-parser is now required at ^5.6 instead of ^5.0. Archetype
parses with php-parser's newest supported version, and 5.5 and older reject
PHP 8.5 syntax with a parse error. Composer upgrades php-parser within 5.x,
and nothing changes in your own code.Your coding agent can read these notes before it upgrades. Set up the MCP server β
Seven implicit-nullable parameters that raised deprecation notices on PHP 8.4.
Maintenance only. No API changes β nothing here can break existing usage.
v2.0.0 shipped the php-parser 5 port in May 2024 having never been tested against any PHP or Laravel version currently in use: the CI matrix still targeted PHP 7.4/8.0 with Laravel 6/7/8, and hadn't run since. The package worked; there was just no evidence of it. This release supplies the evidence and fixes what turned up along the way.
| Archetype | PHP | Laravel | php-parser |
|---|---|---|---|
| 2.x | 8.1β8.4 | 10, 11, 12, 13 | ^5.0 |
| 1.x | 7.4β8.1 | 6β9 | ^4.11 |
Verified across twelve PHP Γ Laravel combinations in CI, plus macOS and PHPStan. Laravel 13 is included because statamic/cms 6 already allows it, so people were running Archetype there untested.
->throw() had matched nothing since 2.0.0. php-parser 5 removed Stmt\Throw_ and the class map still pointed at it. Now maps to Expr\Throw_, with a regression test.getReflection() caught Exception instead of Throwable. A file whose parent class or trait can't be autoloaded raises an Error, which escaped and killed the whole query rather than skipping that one file. Affects LaravelFile::models(), controllers() and serviceProviders().commands_root and controllers_root in the shipped config both pointed at app/HTTP/Controllers.Declares a php requirement for the first time (^8.1). The upper bound is deliberate: PHP 9 removes dynamic properties, which the AST node-identity mechanism still relies on, so Composer declining the install beats handing you a package that fatals.
Also adds the missing LICENSE.md, a changelog, and a Dependabot config.
From 2.0.0 β drop-in, provided you're on PHP 8.1+.
From 1.x β worth doing. 1.x pins nikic/php-parser to ^4.11, which can't coexist with anything needing php-parser 5, Pest 3 and newer included. If Composer refuses to resolve ajthinking/archetype, that's why. No changes to your own code are required.
statamic/cms is the largest consumer, and this release was checked against it specifically. Real installs of Statamic 5 (Laravel 12) and Statamic 6 (Laravel 13) both resolve 2.0.1 and produce byte-identical output to 2.0.0 across every code path Statamic exercises. Statamic 4 and 3.4 pin ^1.0.3 and are unaffected.
Full details in CHANGELOG.md and #87.
Maintenance only. No API changes, and nothing here can break existing usage.
statamic/cms 6 already allows it.php requirement (^8.1) in composer.json. The package never declared
one, so Composer could not warn anybody. 8.1 is the floor the code actually
needs and the whole range CI exercises; the upper bound is deliberate, because
PHP 9 removes dynamic properties and the AST node-identity mechanism still
relies on them.LICENSE.md. The package has always been MIT; the file was missing..github/dependabot.yml, so dependency updates are configured rather than
running on defaults.tests/fixtures/laravel instead of copying one out of vendor/laravel/laravel
at runtime. Laravel 11 removed most of the files the suite relied on
(app/Console/Kernel.php, app/Exceptions/Handler.php, RouteServiceProvider
and the middleware), which made the old approach untestable on current Laravel.
laravel/laravel is no longer a dev dependency.actions/checkout@v4 and actions/cache@v4, and no longer uses the
::set-output command that GitHub has disabled.phpunit.xml migrated to the PHPUnit 10+ schema.Archetype\Tests\ moved out of the production autoloader into autoload-dev.minimum-stability is now stable.PHPFile::namespace(), Namespace_::namespace(), FileInput::load(),
InputInterface::load(), EndpointProvider::__construct(),
PHPParserPropertyMap::propertyMap() and ASTQueryBuilder::traverseIntoClass()).getReflection() now catches Throwable rather than Exception. A file whose
parent class or trait cannot be autoloaded raises an Error, which previously
escaped and killed the entire query instead of skipping that one file. This
affects LaravelFile::models(), controllers() and serviceProviders().tests/Pest.php no longer defines a global context() helper. Laravel 11 ships
its own context(), and the collision brought the whole suite down before a
single test could run.Add support for php-parser 5, Drops support for php parser 4.
Thanks to @jasonvarga β¨
nikic/php-parser ^5.0. Thanks to @jasonvarga (#85).Last release of the 1.x line, which requires nikic/php-parser ^4.11.
Last release of the 1.x line, which requires nikic/php-parser ^4.11.
1.x cannot be installed alongside anything that needs php-parser 5 β including
Pest 3 and newer. If Composer refuses to resolve ajthinking/archetype, upgrade
to 2.x.
This feature provides a BuilderFactory instance when passing a closure to insertStmt.
This feature provides a BuilderFactory instance when passing a closure to insertStmt.
PHPFile::make()->class(\App\Dummy::class)
->astQuery()
->class()
->insertStmt(function(BuilderFactory $builder) {
return $builder->property('someProperty')->getNode();
})
->commit()
->end()
->preview();
When astQuery()->insertStmt(.....) had no matches to operate on, it added the node to the end of the file. This was fixed by adding a guard clause.
When astQuery()->insertStmt(.....) had no matches to operate on, it added the node to the end of the file. This was fixed by adding a guard clause.
Improve pretty printing when creating new classes
withEach methodUse dependency injection for maker
PHPFile::make() now return a _Maker_ instance. Makers allows creating files from a template, for instance: ` PHPFile::make()->file('scripts.php') PHPF
PHPFile::make() now return a Maker instance. Makers allows creating files from a template, for instance:
PHPFile::make()->file('scripts.php')
PHPFile::make()->class(\App\Car::class)
We can implement a custom maker and attaching it to the property "maker" on the File instance.
File methods no longer rely on obscure __call magic, instead minimal stubs are implemented to explicitly forward calls to the corresponding endpoint class.
Avoid Str macros which may cause segmentation fault in statamic/cms
Avoid Str macros which may cause segmentation fault in statamic/cms
Nothing published for this version
Fixes bug when creating classes.
Fixes bug when creating classes.
Now we can create classes like so:
namespace App;
PHPFile::make()->class(Models\Car::class);
PHPFile::make()->class(\App\Models\Car::class);
PHPFile::make()->class('App\Models\Car');
PHPFile::make()->class('\App\Models\Car');
PHPFile::make()->class('app/Models/Car.php');
all of these will write two app/Models/Car.php.
Adds ability to enter Node class and properties in one go: `php $astQuery->classMethod('name->name') `
$astQuery->classMethod('name->name')
$this->file->astQuery()
->class()
->property()
->where->propertyProperty('name->name')->is($key)->get()
->replace(function() {
...
};
get(). Results are evaluated to see if they have results (considered thruty) or empty (falsy).Dumpable proxies on astQueryBuilder for ->dd->something() and ->dump->anotherfromString can allow pseudo phpPHPFile::addMissingTags()->fromString('$hey = 1337')
In order to tighten this package up and consolidate around primary features, we will drop the following incomplete/broken functionality:
Furthermore,
TestablePHPFile facade.TestableAstQueryBuilder facade.Better array formatting π π π Works for newly created, loaded or modified code.
Better array formatting π π π Works for newly created, loaded or modified code.
class Finally
{
protected $empty = [];
protected $one = [
'one',
];
protected $moreThanOne = [
'one',
'two',
];
}
Thanks for spotting this @jackmcdade
Fixes an issue with doctrine/dbal
Fixes an issue with doctrine/dbal
:bug: Fix bug in notInOperator by @ordago π Allow doctrine/dbal ^2.10 by @WorldSeso7 :white_check_mark: Bump dependecies, typos and test updates
:bug: Fix bug in notInOperator by @ordago
π Allow doctrine/dbal ^2.10 by @WorldSeso7
:white_check_mark: Bump dependecies, typos and test updates
Include nikic/php-parser as a dependency, don't assume it is included elsewhere.
Include nikic/php-parser as a dependency, don't assume it is included elsewhere.
Nothing published for this version
Rename mismatching class name/file name. Fixes #15
Rename mismatching class name/file name. Fixes #15
### Support for class constant $file->classConstant('HOME') Thanks to @seryak
$file->classConstant('HOME')
Thanks to @seryak
Format preserving code manipulation
Don't use facade aliases which might be unavailable.
Don't use facade aliases which might be unavailable.
Nothing published for this version
Fix class resolving when using archetype schema in remote context
Fix class resolving when using archetype schema in remote context
Happy to announce a core set of features including some experiments π₯
Archetype v0.1.0 :rocket:<img src="https://media2.giphy.com/media/26ufdipQqU2lhNA4g/giphy.gif" alt="Blow Your Mind Wow GIF by Product Hunt" style="width: 480px; height: 480px; left: 0px; top: 0px; opacity: 1;"></img>
<img src="https://media1.giphy.com/media/JmVcakKIdojgpBC2iw/giphy.gif?cid=ecf05e4716bcbf15b2022dac6414189dd9ecc4ddcaf1f823&rid=giphy.gif" alt=" dance dancing friday friyay fridays GIF" style="width: 350.263px; height: 550px; left: 0px; top: 0px; opacity: 1;"></img>
<img width="200px" src="https://user-images.githubusercontent.com/3457668/87406372-e71c3680-c5c0-11ea-98d3-2a21b1bf77e2.png"></img>
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
In the astQuery(), you can now access general classes/objects/structures with ->methodCall() or similar. To enter a property, simply use ->stmts witho
In the astQuery(), you can now access general classes/objects/structures with ->methodCall() or similar. To enter a property, simply use ->stmts without ()
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.