Download the PHP package franz-deleon/fdl-construct-invoker without Composer

On this page you can find all versions of the php package franz-deleon/fdl-construct-invoker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fdl-construct-invoker

FdlConstructInvoker

A ZF2 module that enables argument passing to class constructors (__construct()) that requires or not require arguments at construction time.

Quick glimpse:

// syntax
$this->getServiceLocator()->get('MyInvokableClass')->construct([$firstArg [, $secondArg [, $...]]]);

INSTALLATION:

Register FdlConstructInvoker module in application.config.php. It is important to note that you need to have the module loaded first BEFORE other modules who uses it!

    return array(
      'modules' => array(
          'FdlConstructInvoker', // <<---- Needs to be ontop of Application module
          'Application', // I use FdlConstructInvoker so i need to be bellow it!
          ),
      'module_listener_options' => array(
          'module_paths' => array(
              './module',
              './vendor'
          ),
          'config_glob_paths' => array('config/autoload/{,*.}{global,local}.php')
      )
    );

USAGE:

An example class that you want to register to the service manager.
Notice the class requires a $brick instance in its constructor.

    namespace class\namespace;
    class Brick
    {
        protected $brick;

        public function __construct($brick)
        {
            $this->brick = $brick;
        }

        public function getBrick()
        {
            return $this->brick;
        }

        public function setBrick($briok)
        {
            $this->brick = $brick;
        }
    }

Register your invokable classes in your modules using the provided getConstructInvokerConfig() method.

    // Module.php of Application module
    public function getConstructInvokerConfig()
    {
        return array(
            'invokables' => array(
                'brick' => 'class\namespace\Brick',
            ),
        );
    }

Now you can access the class anywhere you have the main ServiceManager. For example, inside a controller.
Take note of the get('brick')->construct() method whick accepts arguments for the constructor.

    // from an action controller
    public function SomeAction()
    {
        // access it directly from the ServiceManager
        $brick = $this->getServiceLocator()->get('brick')->construct('Concrete Brick');
        echo $brick->getBrick();
        // returns "Concrete Brick"

        // you can also access through the Construct Invoker plugin manager
        $brick2 = $this->getServiceLocator()
                       ->get('constructInvokerPlugin')
                       ->get('brick')
                       ->construct('Hollow Blocks');
        echo $brick2->getBrick();
        // creates new instance of brick object and returns "Hollow Blocks"

        // same instance of brick
        echo $brick->getBrick(); // returns "Concrete Brick"
        $brick->setBrick('Marbles');
        echo $brick->getBrick() // returns "Marbles"
    }

It will also work for regular invokable classes that are not using constructors:

    // pretend SomeClass is registered using getConstructInvokerConfig()
    echo $this->getServiceConfig->get('SomeClass')->someMethod(); // whatever somemethod does...

UNDER THE HOOD

FdlConstructInvoker module uses the Peering Service Manager functionality of the Service Manager. Modules who disable this may not be able to do directy below:

$this->getServiceLocator()->get('someclass')->construct()

If this is the case. Use the Construct Invoker Plugin Manager:

$this->getServiceLocator()->get('constructInvokerPlugin')->get('someclass')->construct();

All versions of fdl-construct-invoker with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.3
zendframework/zendframework Version >=2.2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package franz-deleon/fdl-construct-invoker contains the following files

Loading the files please wait ....