Repository navigation
v0.3.0
⚠️ Upgrading
-
Composer constraints of your project (root
composer.json, created from the boilerplate):clementdecou/simply-framework:^0.3;clementdecou/simply-maker:^0.4;clementdecou/simply-mvc(if installed):^0.3;symfony/dotenv:^7.4.
Then run
composer update -W. Any other package of the project that requires Symfony 6 blocks the update. WordPress plugins that bundle an unscoped copy of Symfony load the same classes as Simply, so check them as well. -
Your own code extending Symfony classes (in your plugins and theme
src/):- Console commands: replace
protected static $defaultNamewith#[AsCommand(name: '…', description: '…')]and declareexecute(...): int. Simply Maker registers every command it finds, so a single command without a name breaks the wholebin/console. - Configuration classes: declare
getConfigTreeBuilder(): TreeBuilder. Otherwise the container build fails on the first request. ContainerAwareInterfaceandContainerAwareTraitno longer exist: inject the services you need.- See Symfony's UPGRADE-7.0 for the other changes.
- Console commands: replace
-
Check on a staging environment: run
php bin/console listand load a few pages before deploying.
There is no need to clear the cache for the upgrade itself: the new package versions change the cache fingerprint.
⚠️ Breaking changes
Symfony 7.4 is required
symfony/dependency-injection, symfony/config, symfony/finder and symfony/yaml now require ^7.4. Use simply-maker 0.4 and simply-mvc 0.3, which require this version.
Cache (#74)
- The container and Twig templates are cached in
SIMPLY_CACHE_DIRECTORY/<fingerprint>/. The fingerprint is computed from the installed Composer packages, the configuration directories, the registered plugins and theme, andWP_DEBUG. Updating a package, switching theme or adding a configuration directory rebuilds the cache automatically. When the cache is rebuilt, caches of other fingerprints that have not been modified for an hour are removed. - The cached container class is now
CachedContainer_<fingerprint>instead ofCachedContainer. - Code changes that Composer does not see (your services, YAML configuration, Twig templates) still require
php bin/console simply:cache:clearwhen deploying withWP_DEBUGset tofalse.
Hooks declared with #[Action] and #[Filter] (#75)
- Services are resolved lazily: a service holding attribute hooks is instantiated the first time WordPress runs one of its hooks, no longer on every request. Its constructor runs at that moment.
- The WordPress callback is a
Simply\Core\Hook\LazyHookListener, no longer[$service, 'method'].remove_action()andhas_filter()called with[$service, 'method']no longer find these hooks. - A service whose id is not its class name, and several services of the same class, now get their hooks.
- The container build now fails with an explicit message when an attribute method is not public or takes a parameter by reference.
- Removed:
Simply\Core\Compiler\HookCompiler;Action::setCallable(),Action::register(),Filter::setCallable()andFilter::register().ActionandFilterare plain attributes and no longer implementHookableInterface;- the
simply.compile_hookscontainer parameter.
HookManager::__construct()now takes the attribute hooks and a service locator.
HookableInterface and the wp.hook tag are unchanged.
New
simply:debug:hookis now available inbin/console. It was never registered before. It resolves closures, invokable objects and lazy attribute hooks, and shows the service id when it differs from the class.- Hook services may use
ServiceMethodsSubscriberTrait.ServiceSubscriberTraitis deprecated by Symfony but still supported. - With PHP 8.4, lazy services use native lazy objects and no longer emit var-exporter deprecations.
What's Changed
- feat(cache): rebuild the cache reliably when its inputs change by @Amorfx in #74
- refactor(hook): register attribute hooks by service id and lazily by @Amorfx in #75
- feat(core)!: require Symfony 7.4 by @Amorfx in #76
Full Changelog: v0.2.8...v0.3.0