To contribute to this documentation, please submit a pull request to our learn repository.
php bakery bake.
UserFrosting uses a dynamic routing system for serving assets in a development environment. For this to work on an Apache webserver,
mod_rewrite needs to be enabled, and you need to give Apache permission to use the
.htaccess file in
If you have shell access to your server, please take the following steps (from Stack Overflow):
sudo a2enmod rewrite
sudo service apache2 restart
If this still does not work, you may need to change the override rule in your Apache configuration to allow Apache to use UserFrosting's
000-default.conf). In XAMPP, for example, this file is located at
You may need a server admin to do this if you are using shared hosting.
If you get an error stating rewrite module is not found, then your
userdir module is probably not enabled. To enable it:
sudo a2enmod userdir
For more information, see this blog article.
The "There is no class mapped" error occurs when you attempt to use the dynamic class mapper with an identifier that has not been successfully mapped to a class name. If you are sure that you defined the mapping in your Sprinkle's
ServicesProvider class, it is likely that UserFrosting is simply not even finding your
ServicesProvider class itself. This is usually due to using an incorrect namespace for your Sprinkle.
It's important to understand that UserFrosting uses a very strict, case-sensitive naming convention for Sprinkle namespaces. UserFrosting will convert your Sprinkle's directory name to studly caps when it builds the fully qualified namespace where it expects your
Migration classes to be found. If your Sprinkle's namespace does not match what UserFrosting is expecting, it will not find and load these classes. This will not cause an error directly, but will manifest in other parts of your code that depend on these classes to be located successfully.
Studly caps uses the following code to convert your Sprinkle directory name to an expected namespace:
$value = str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $value)));
As you can see, all
_ characters are first converted to spaces. Then, PHP's
ucwords function is used to capitalize each word. Finally, the spaces are removed.
|Sprinkle directory||Sprinkle namespace|
We strongly recommend using only lowercase words separated with
- for Sprinkle directory names.
You may need to re-run Composer if you change your Sprinkle directory path or namespace. On certain operating systems with case-insensitive filesystems, Composer may not update the directory -> namespace mappings correctly. You may need to completely erase your
app/vendordirectory and re-run
composer installin these cases.
production mode, by default, enables FastRoute's route caching. This can result in route definitions not being updated in the cache during production. To resolve this, you should clear the route cache in