Custom shared libraries
You can add custom libraries shared by all packages.
Add the classes in the lib directory from the project root. Create the lib directory if not exists.
Example
<?php
// lib/Tools.php
declare(strict_types=1);
class Tools
{
public function format(string $value): string
{
return ucfirst(strtolower($value));
}
}
You can then instantiate the class anywhere.
<?php
$tools = new Tools();
echo $tools->format('Hello World!');
- Installation
- Configuration
- Add a new package
- Add a new HTML page
- Templating best practices
- Add a new block
- Assets
- Serve any type of file
- Rewrite a route
- Data assignment
- Objects and class fallback
- Models
- Database
- Forms
- Session messages
- Send emails
- Captcha
- Framework tools
- Console Commands
- Hooks
- Custom shared libraries
- External libraries with composer
- Write content in Markdown
- Static Site Generator