Download the PHP package cadre/module without Composer

On this page you can find all versions of the php package cadre/module. 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 module

Cadre.Module

This is a lightweight module system based on Aura.Di.

This library defines several classes that implement Aura\Di\ContainerConfigInterface so it can be used in any project that uses Aura.Di.

This is in early development so please provide feedback via Issues.

Installation and Autoloading

This package is installable and PSR-4 autoloadable via Composer as cadre/module.

Alternatively, download a release, or clone this repository, then map the Cadre\Module\ namespace to the package src/ directory.

Dependencies

This package requires PHP 7.0 or later; it has been tested on PHP 7.0 and PHP 7.1. We recommend using the latest available version of PHP as a matter of principle.

Quality

Scrutinizer Code Quality Code Coverage Build Status

To run the unit tests at the command line, issue composer install and then vendor/bin/phpunit at the package root. This requires Composer to be available as composer, and PHPUnit to be available as vendor/bin/phpunit.

This package attempts to comply with PSR-1, PSR-2, and PSR-4. If you notice compliance oversights, please send a patch via pull request.

Example

Cadre\Module\ModuleInterface

This interface extends Aura\Di\ContainerConfigInterface and defines four methods.

require()

Returns an array of class names of other modules that it requires.

conflict()

Returns an array of class names of other modules that it conflicts with.

replace()

Returns an array of class names of other modules that it replaces.

Cadre\Module\Module

This is a base class that your module can extend. It contains default implementations of all methods from Cadre\Module\ModuleInterface.

loader()

This method is only defined on Cadre\Module\Module and returns the associated Cadre\Module\ModuleLoaderInterface.

This is so you can conditionally configure your module based on the existance of other modules.

Cadre\Module\ModuleLoaderInterface

This interface extends Aura\Di\ContainerConfigInterface and defines three methods.

loaded($name)

Returns true or false if the module specified by $name has been loaded.

isEnv($environment)

Returns true or false if the ModuleLoader was instanciated with the specified environment.

isContext($context)

Returns true or false if the ModuleLoader was instanciated with the specified context.

Cadre\Module\ModuleLoader

This class does all the work. It contains default implementations of all methods from Cadre\Module\ModuleInterface.

__construct(array $modules, string $environment = '', string $context = '')

When you create a new ModuleLoader you pass into it the modules you want to load.

You may also specify the environment you're running. When you specify a environment we will check for a method requiring modules when in that environment. For example if your environment is "dev" we will look for a method requireDev.

To generate the method name we convert a snake cased (ex: special_environment) environment into a camel cased method name prefixed with "require" (ex: requireSpecialEnvironment).

You may also specify the context you're running. By default we do nothing with the context. However, you can query it via isContext method on the loader from inside a module. For example if your context is "web" you could query against it like if ($this->loader()->isContext('web')) { } and configure things differently.

protected resolveDependencies()

This method is called from loaded, define and modify.

It starts with the list of modules from the constructor and goes through them loading the modules and then adding require and optionally require{Environment} modules to the list to load.

Throws Cadre\Module\ConflictingModuleException if conflicting module is loaded. Throws Cadre\Module\AlreadyReplacedException if replaced module has already been replaced. Throws Cadre\Module\AlreadyLoadedException if replaced module has been loaded.

define(Container $di)

Passes through to the define method on all loaded modules.

modify(Container $di)

Passes through to the modify method on all loaded modules.


All versions of module with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
aura/di Version ^3.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 cadre/module contains the following files

Loading the files please wait ....