Download the PHP package lorenzo/piping-bag without Composer

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

Dependency Injection Container Plugin for CakePHP 4

This plugin adds the ability to configure object instances and their dependencies before they are used, and to store them into a container class to easy access.

It uses the clean and flexible Ray.Di Library which is a PHP dependency injection framework in the style of "Google Guice".

Ray.Di also allows you to program using AOP, that is, decorating the configured instances so some logic can be run before or after any of their methods.

Installation

You can install this plugin into your CakePHP application using composer.

Configuration

Upgrading from library version 1.x (Cake 3.x)

DEPRECATED:

Remove the following lines in your: config/bootstrap.php:

Controller Injection

For getting injection in your controllers to work you need to add the following line in the bootstrap method of your Application.php:

Shell Injection

For getting injection in your controllers to work you need to add the following line of your bin/cake.php:


Additionally, you can configure the modules to be used and caching options in your config/app.php file.

Modules can also be returned as instances in the configuration array:

Finally, if you wish to tune your modules before they are registered, you can use a callable function:

What is a Module anyway?

Modules are classes that describe how instances and their dependencies should be constructed, they provide a natural way of grouping configurations. An example module looks like this:

Modules are, by convention, placed in your src/Di/Module folder. Read more about creating modules and how to bind instances to names in the Official Ray.Di Docs.

Usage

After creating and passing the modules in the configuration, you can get instance of any class and have their dependencies resolved following the rules created in the modules:

Injecting Dependencies in Controllers

Ray.Di is able to inject instances to your controllers based on annotations:

As soon as the controller is created, all methods having the @Inject annotation will get instances of the hinted class passed. This works for constructors as well.

Injecting Dependencies in Controller Actions

It is also possible to inject dependencies directly in the controller actions. When doing this, add the type-hinted dependency to the end of the arguments and set the default value to null, it is also required to annotate the method using @Assisted

Injecting Dependencies in Shells

Shells are also able to receive dependencies via the @Inject annotation. But first, you need to change the cake console executable to use PipingBag. Open your bin/cake.php file and make it look like this:

Then you can apply annotations to your shells:


All versions of piping-bag with dependencies

PHP Build Version
Package Version
Requires ray/di Version ^2.1
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 lorenzo/piping-bag contains the following files

Loading the files please wait ....