Luminova Framework

Services Configuration

Last updated: 2024-05-12 13:08:03

The Service Configuration class allows you to register services to be autoloaded and discoverable anywhere in your application. It allows you specify initialization arguments, and optionally specify whether the class instance should be shared, and whether it should be serialized and stored as cache.

  • Class namespace: \App\Controllers\Config\Services
  • File path: /app/Controllers/Config/Services.php
  • Parent class: \Luminova\Base\BaseServices


Enable the service feature by setting = enable in your environment configuration file.


To get started with service usages and method read the Application Service Guide.


Register services to autoload and make them discoverable.

public bootstrap(): void

To register a classes, use the static newService method available in BaseServices within the bootstrap method as shown below.

Do not create a duplicate of the bootstrap method or the Service class. To register multiple classes, simply add each class in a new line within the bootstrap method using newService.


namespace App\Controllers\Config;

use Luminova\Base\BaseServices;
use App\Controllers\Utils\YourServiceClassName;

class Services extends BaseServices
    public function bootstrap(): void
            YourServiceClassName::class, // Class name to register.
            null, // Class name alias (defaults to the class basename if null).
            true, // Should return shared instance.
            true, // Should serialize and store the class object.
            [ // Initialization arguments, must be array list (int keys)
                new fooClass(), 
                ['my', 'key' => 'array']