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.
_all
filter, which will search all filterable fields by default.See Cache for more info.
composer.json
moved to top-level directorysprinkles.json
moved to app/
directorybundle.config.json
renamed to asset-bundles.json
core
sprinkle must be explicitly listed in sprinkles.json
pages/abstract/base.html.twig
, pages/abstract/default.html.twig
, or pages/abstract/dashboard.html.twig
. Modals, forms, and tables have been moved out of components/
. Navigation components now have their own top-level navigation/
directory.schema/
to schema/requests/
. This is more semantic and allows us to use this directory for other types of schema files as well.migrations/install.php
.src/Model
to src/Database/Models
migrations/
to src/Database/Migrations
, and must extend the base Migration
class to implement up
and down
methods.EventSubscriberInterface
, allowing the class to hook into the UF application lifecycle.src/ServicesProvider/ServicesProvider.php
.assets/local
has been renamed assets/userfrosting
, and subdirectories in this directory have been rearranged as well.admin/
part of all routes in the admin
sprinkle was removed.onAddGlobalMiddleware
, instead of index.php
.src/Handler
to src/Error/Handler
.ExceptionHandler
has changed. There is no longer ajaxHandler
and standardHandler
- everything is handled via handle
now. 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 src/Error/Renderer
classes.HttpException
have 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 HttpExceptionHandler
.src/Facades/Facade
moved to system/Facade
.userfrosting.log
nowufTable
now uses the pagination widget instead of the plugin, which changes the naming of their options if you happened to override any of the defaults.js-download-table
-> js-uf-table-download
uf-table-info-messages
-> uf-table-info
(styling) and js-uf-table-info
(functional)tablesorter-pager
-> tablesorter-pager
(styling) and js-uf-table-pager
(functional)menu-table-column-selector-*
-> uf-table-cs-*
(styling) and js-uf-table-cs-*
(functional)table-search
-> uf-table-search
(styling)ufForm
now sets a dataType
in the call to .ajax
- we've customized it to handle malformed JSON responses, but it could still cause problems for some peoplesrc/Model/UFModel
deprecated; use src/Database/Models/Model
nowifCond
Handlebars helper deprecated; use ifx
insteadUpgrading 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 extends
and include
tags within the templates themselves, as well as references within controllers (in calls to render
).
bundle.config.json
to asset-bundles.json
.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 init
method. 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/Model
to src/Database/Models
, and change them to extend the base UserFrosting\Sprinkle\Core\Database\Models\Model
class. Keep in mind that when you move your classes to a different directory, you need to change their namespace
as well to comply with PSR-4 autoloading rules.migrations/*
file, create a new class in src/Database/Migrations
instead. This should extend the base UserFrosting\System\Bakery\Migration
class to implement up
and down
methods. See Migrations for more information.schema/
to 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.