Download the PHP package m3m0r7/php-deferrable without Composer

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

PHP-Deferrable - Simple and Powerful deferrable run code library

The PHP-Deferrable is a simple and powerful deferrable run code library. This library like Golang. This library is very simple because this is not depending other libraries.

Documents

Install

Use composer:

Issues to date

Go has a defer, and you can execute the contents of the defer before returning. However, although PHP does not have a defer, it is possible to achieve defer using try-finally or destructor destruction timing.

This has some problems: the post-processing code can be cumbersome, and if the try syntax gets too long, you won't know what to do. And you will suffer from unnecessary indentation.

php-deferrable solves all of these problems by providing very simple functions and classes to solve the problem.

Quick Start

It will show as below:

Deferrable function

You can pass a function into the deferrable.

It will show as below:

Deferrable function can be return a value.

It will show as below:

Deferrable can manipulate resource context.

defer can be passed any parameters and it will copy based the context.

It will show as below:

And it can be changed the parameter value in defer function with reference.

It will show as below:

Exception of defer

Normally, php-deferrable is designed so that even if an exception is thrown in the defer, the processing of the stacked defer continues. This is to resolve the inconsistency that Go has no exceptions, but PHP does.

In the case of the above example, all exceptions are combined and returned as MergedDeferringException.

However, you may want to stop if an exception occurs. Of course, such means are also available. If an exception occurs, there are two ways to suspend defer processing.

The first uses DeferBailableScope :: of to return the current deferrable scope itself if an exception occurs.

or to use in class:

In this case, FirstException is thrown as an exception to the outer scope. The reason FirstException is thrown is The defer process pops the stack. In other words, the process is started from the last registered defer. Also, in contrast to DeferBailableScope, if you want to explicitly specify an exception that can be continued, useDeferContinuableScope.

The second is to throw an exception that inherits from DeferBailableExceptionInterface. If you inherit from this interface, stop merging exceptions at that point and return only those inherited exceptions.

In the above case, a SecondException is thrown. In the case of Defer :: createContext, it can be controlled by passing the scope type as the first argument.

In the above case, FirstException is thrown as an exception.

Context Manipulator

The context manipulator is very simple deferrable functions manipulator. You can take possible to decreasing memory usage with using it. It is not required wrapping with deferrable function for you wanting to deferring a class.

License

MIT


All versions of php-deferrable with dependencies

PHP Build Version
Package Version
Requires php Version >=7.2
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 m3m0r7/php-deferrable contains the following files

Loading the files please wait ....