Download the PHP package beige/invoker without Composer

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

Beige Invoker

GitHub license LICENSE Coverage 100%

基于容器技术的轻量级调用器

A lightweight invoker based on container.

简介

invoker 负责调用或实例化用户指定程序,并且利用 PSR-11 容器标准获取程序的依赖参数的实例。它是一个高效的,不关心参数顺序的依赖注入工具,可以给与你最大限度的灵活度和自由度。

安装

使用

Beige\Invoker\Invoker 继承于 Beige\Invoker\Interfaces\InvokerInterface,实现了三个标准方法:

Beige\Invoker\Invoker::call(callable $function[, array $parameters]): mixed:

调用一个 callable 对象或函数,并注入依赖项到callable 对象或函数:

参数:

返回值:

上面的例子简化了具体的代码实现,首先,Beige\Invoker\Invoker 的构造方法接受一个 Psr\Container\ContainerInterface 容器实例,我们需要将 Test 作为容器项索引提前实例放进容器中,$function 通过声明参数类型 Test 来获取对应的实例,这个 Test 的实例就是从容器中获取到的。

上例中的 $function 函数中还包含一个额外的参数 $foo,我们通过 Invoker 第二参数 $parameters 传入。$parameters 是一个数组,它的键必须与需要绑定的参数名称相同。实际上,$function 的参数不需要遵循任何顺序的束缚。

这些规律也适用于接下来的所有调用器方法。

Beige\Invoker\Invoker::new(string $className[, array $parameters]): object:

实例化一个 php 类,并注入依赖项到类的构造方法。 参数:

返回值:

上例与 Invoker::call 非常相似,只是由函数调用变成了对类的实例化操作。我们调用 Invoker::new 方法,从容器中取出 Test 类型的实例,并绑定到构造方法的 $test 参数上,并用第二个参数注入了自定义参数 $foo,最终得到 Invokeable 的实例。

Beige\Invoker\Invoker::callMethod(object $instance, string $method[, array $parameters]): mixed:

调用一个对象的方法,并注入依赖项到这个方法中。

参数:

返回值: 返回方法的返回值

Invoker::new 很相似,Invoker::callMethod 也会读取类型声明注入参数。


All versions of invoker with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
psr/container Version ^1.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 beige/invoker contains the following files

Loading the files please wait ....