Launchpad
Launchpad
Launchpad
  • Introduction
  • General
    • Installation
    • Creating a subscriber
    • Contributing
  • Tutorials
    • Beginner documentation
      • Beginner handbook
        • Creating subscribers
        • Wiring subscribers
        • Installing local environment
        • Adding front-end
        • Building the plugin
      • Plugin life circle
        • Activation
        • Deactivation
        • Uninstall
    • Starting with the framework
    • Migrating to Launchpad
    • Notions
      • Framework concepts
        • Inversion of control
        • Subscribers
        • Dispatcher
      • Good practices
        • Hooks
          • Preventing magic constants
          • Decouple features
          • Sanitize filters output
      • Testing
        • Organize tests
  • CLI
    • Commands
    • Creating a command
  • Testing
    • Unit test
    • Fixtures
    • Integration test
  • Container
    • Architecture
    • Parameters
    • Providers
    • Auto wiring
    • Manual wiring
    • Activation/Deactivation
    • Inflectors
  • Modules
    • Definition
    • Listing
      • Action Scheduler
      • BerlinDB
      • Bus
      • Options
      • Renderer
      • Logger
      • Uninstaller
      • Filesystem
      • Front-end
      • Hook extractor
    • Creating a module
Powered by GitBook
On this page
  • What are parameters
  • Register a parameter
  • Use a parameter
  1. Container

Parameters

What are parameters

Not every value we want to register can be registered using a class.

Due to that need to add other values into the container than classes.

These values are called parameters and can be an array, a string, a integer etc.

Register a parameter

To register a parameter you will have to add it to the array inside the file configs/parameters.php.

The key of the parameter will be its name and the value its value.

return [
   'key' => 100,
   'key2' => [
     'string'
   ],
];

Use a parameter

To use a parameter you will have to call it from the constructor of the class when you are using the auto-wiring strategy:

public function __construct($key) {

}

With the manual strategy you will have to call it from the container:

$this->getContainer()->get('key');
PreviousArchitectureNextProviders

Last updated 11 months ago