UserFrosting 4.1 brings improved organization of the codebase, factoring out the Sprinkle management system from the
core Sprinkle itself. The Bakery makes it easier than ever to get UserFrosting up and running, as well as handling other command-line tasks from a unified interface.
We've also switched to an event-driven application lifecycle that uses Symfony's event dispatcher to allow each Sprinkle to hook into critical points in the UserFrosting lifecycle.
New tools for setting up UF, checking requirements, installing, and asset management. They're great!
The main lifecycle logic (Sprinkle loading) has been moved out of the
core Sprinkle and into
app/system. Sprinkles can hook into the main UF application lifecycle via their bootstrap class. Available methods so far:
With a new WhoopsRenderer for attractive, informative debugging pages!
Sprunjes can now generate enumerations of unique values for a specific field. Very useful in generating lists of options, for example, in tablesorter selection menus.
_allfilter, which will search all filterable fields by default.
See Cache for more info.
composer.jsonmoved to top-level directory
coresprinkle must be explicitly listed in
pages/abstract/dashboard.html.twig. Modals, forms, and tables have been moved out of
components/. Navigation components now have their own top-level
schema/requests/. This is more semantic and allows us to use this directory for other types of schema files as well.
src/Database/Migrations, and must extend the base
Migrationclass to implement
EventSubscriberInterface, allowing the class to hook into the UF application lifecycle.
assets/localhas been renamed
assets/userfrosting, and subdirectories in this directory have been rearranged as well.
admin/part of all routes in the
adminsprinkle was removed.
onAddGlobalMiddleware, instead of
ExceptionHandlerhas changed. There is no longer
standardHandler- everything is handled via
handlenow. Decisions about request type (ajax, standard) and error display mode (settings.displayErrorDetails, site.debug.ajax) are now delegated to the handlers. Error rendering is delegated to
HttpExceptionhave been renamed.
http_error_code => httpErrorCode, and
default_message => defaultMessage. If you have any custom child exceptions that extend
HttpException, you'll need to update these variable names to work properly with the
ufTablenow uses the pagination widget instead of the plugin, which changes the naming of their options if you happened to override any of the defaults.
ufFormnow sets a
dataTypein the call to
.ajax- we've customized it to handle malformed JSON responses, but it could still cause problems for some people
ifCondHandlebars helper deprecated; use
Upgrading UserFrosting to
4.1.x is as simple as getting the new files and updating dependencies, migrations and assets! If you first installed UserFrosting using git, a simple
git pull or
git pull upstream master. Once you have the new files, simply use composer and Bakery to get up to date with everything else:
$ composer update $ php bakery bake
First, you'll need to update your template structure to reflect the new template organization:
layouts/basic.html.twig => pages/abstract/base.html.twig layouts/default.html.twig => pages/abstract/default.html.twig layouts/error.html.twig => pages/abstract/error.html.twig layouts/dashboard.html.twig => pages/abstract/dashboard.html.twig layouts/modal.html.twig => modals/modal.html.twig components/forms/* => forms/* components/tables/* => tables/* components/default/* => navigation/* components/dashboard/* => navigation/* components/user-card.html.twig => navigation/user-card.html.twig components/breadcrumb.html.twig => navigation/breadcrumb.html.twig components/alerts.html.twig => pages/partials/alerts.html.twig components/analytics.html.twig => pages/partials/analytics.html.twig components/config.js.twig => pages/partials/config.js.twig components/csrf.html.twig => forms/csrf.html.twig components/favicons.html.twig => pages/partials/favicons.html.twig components/footer.html.twig => pages/partials/footer.html.twig components/legal.html.twig => pages/partials/legal.html.twig components/page.js.twig => pages/partials/page.js.twig components/privacy.html.twig => pages/partials/privacy.html.twig
You will need to change references to the new locations of the templates that have moved - in particular, in
include tags within the templates themselves, as well as references within controllers (in calls to
src/ServicesProvider/ServicesProvider.php. This will let UserFrosting load it automatically.
src/Site.php. This should now extend
UserFrosting\System\Sprinkle\Sprinkle. Get rid of the
initmethod. Instead, you should create methods to hook into the UserFrosting lifecycle, if necessary. Otherwise, you can leave this class empty, or delete it entirely.
src/Database/Models, and change them to extend the base
UserFrosting\Sprinkle\Core\Database\Models\Modelclass. Keep in mind that when you move your classes to a different directory, you need to change their
namespaceas well to comply with PSR-4 autoloading rules.
migrations/*file, create a new class in
src/Database/Migrationsinstead. This should extend the base
UserFrosting\System\Bakery\Migrationclass to implement
downmethods. See Migrations for more information.
schema/requests/, and update the paths in your controllers.
The database schema have not changed from UF 4.0 - there is no need to upgrade your database.
See the Changelog for the complete list of changes included in this release.