Download the PHP package directorytree/runnable without Composer

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

Runnable

Run and fake focused PHP classes using Laravel's container.

Tests Total Downloads Latest Version License

Installation · Usage · Testing


Runnable gives your action and query classes a familiar way to run, with results you can easily fake in tests.

Test an order payment without contacting the payment provider:

Requirements

Installation

The service provider is automatically registered. There is no configuration to publish.

Usage

Add the Runnable trait to a class with a public handle() method:

Running Classes

Using the trait:

Using the facade:

Using the helper:

All three run handle() synchronously and return its result. Arguments, including named arguments, are forwarded to handle(), and exceptions propagate to the caller. For the facade and helper, pass the class as the first positional argument.

The facade and helper work without the trait. You can also inject your class and call handle() directly.

Running Instances

Using the facade:

Using the helper:

Runnable executes the supplied instance unless you have registered a fake for its class. Ordinary container bindings do not replace it.

Testing

Call fake() before exercising your application code to replace a runnable's result and verify its calls:

The same fake works with all three execution styles and subsequent container resolutions, including dependency injection. Use it within Laravel application tests so the container and Mockery are reset between tests.

Fakes intercept handle(), so an inline instance's constructor still runs. Calling handle() directly on a real instance bypasses Runnable.

The returned fake supports Mockery assertions, including checking that it was never called:

You can also register a fake through the facade, including for classes without the trait:

Pass null explicitly to return null. Omitting the result uses Mockery's default for the method's return type. Supplied results must satisfy that type.

Faking Callbacks

Provide a closure when the result depends on the arguments:


All versions of runnable with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^12.0|^13.0
illuminate/container Version ^12.0|^13.0
illuminate/contracts Version ^12.0|^13.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 directorytree/runnable contains the following files

Loading the files please wait ...