Docs Navigation Open
Extending Evolution
Use service providers, controllers, views, migrations, classic assets, and manager modules to extend Evolution CMS in a package-friendly way.
Main Extension Choices
- Snippet — dynamic parser-side output
- Plugin — event-driven behavior
- Module — manager-side tool or application
- Template / Chunk / TV — content modeling and presentation
- Package — the correct choice when you need several of the above plus routes, migrations, config, and classes
Why the Package Layer Matters
In Evo 3, the cleanest way to ship real functionality is a package with a service provider. The package can register views, migrations, config, classic assets, manager modules, and Artisan commands in one place.
Example Service Provider
class ExampleServiceProvider extends ServiceProvider
{
protected $namespace = 'example';
protected $commands = [
ExampleInstallDemoCommand::class,
];
public function boot()
{
$this->loadMigrationsFrom(__DIR__ . '/../migrations');
$this->loadViewsFrom(__DIR__ . '/../views', 'example');
$this->publishes([__DIR__ . '/../public/assets/vendor/example' => public_path('assets/vendor/example')], 'example-assets');
$this->publishes([__DIR__ . '/../config/example.php' => $this->resolveConfigPublishPath('example.php')], 'example-config');
$this->loadTranslationsFrom(__DIR__ . '/../lang', 'example');
}
public function register()
{
$this->mergeConfigFrom(__DIR__ . '/../config/example.php', 'example');
$this->commands($this->commands);
$this->loadChunksFrom(dirname(__DIR__) . '/assets/chunks/', $this->namespace);
$this->loadPluginsFrom(dirname(__DIR__) . '/assets/plugins/');
$this->app->registerModule('Example Demo Module', dirname(__DIR__) . '/assets/modules/example/module.php');
}
}
Typical Package Building Blocks
- config for package settings
- migrations for schema changes
- seeders for demo or bootstrap data
- controllers for package routes and page logic
- views for frontend and manager output
- assets/chunks, assets/snippets, assets/plugins, assets/tvs for classic Evolution elements
- assets/modules for a manager module
Controller Example
class ExampleApiController
{
public function getDocuments()
{
return SiteContent::where('parent', 0)
->orderBy('pagetitle', 'asc')
->get();
}
public function getInfo()
{
return Response::json($this->getDocuments());
}
}
Seeder Example
example-package also shows how a package can create templates, TVs, and demo resources with updateOrCreate() inside a seeder.
For the full package anatomy, see Project Structure. For the install and publishing flow, see Installing Extras and Creating an Extra.
Project Structure
Understand the Evo 3 project layout and the package structure used by real custom packages such as example-package.
Events and Modifiers
Use system events and built-in modifiers for targeted customization without rewriting larger parts of the project.