Download the PHP package oliverde8/asynchronous-jobs without Composer

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

Asynchronous - Jobs

PHP AsynchronousJobs is a small library allowing to run PHP code in parallel of your main code. In some ways it works like threads but it doesen't use the proper system libraries to do so. It is a workaround

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

The library was created to work on windows & linux systems without the need of installing php pthreads extension. The library must not be considered as replacement to threads !! The way the library works isn't optimized to for that.

It is built in the purpose of doing long tasks in parallel. A good example would be to download filess while the main script is serving informations to users. The library is ment to be used for command line tools & deamons.

Why

Even throught pthreads is fantastic many servers don't have it installed, and therefore adding a dependency to that can be blocking. In this case the library was built for the ml-expansion project which is used by people that wishes to have something that just works. This library answers to that question.

If you need to run a few threads time to time without wanting to add a dependency to pthreads this library might just be want you need.

FAQ

https://github.com/oliverde8/PHP-AsynchronousJobs/wiki/Faq

Usage

First you need to create a job :

Then you can create a job :

Let's create a second job as well.

Now execute the jobs

You should see first "I end after 2" then the message "I end after 3"

Waiting for ongoing jobs

Once you started some jobs you may decide you need to wait for them to finish.

So once you have started your jobs :

You can use wait all :

This will block you instance until all jobs habe finished their execution. waitForAll takes in parameters the sleep time. So if you know your jobs takes a few jours to run you can increase the sleep time to a few minutes to prevent IO to be over used.

You may also wish for just one job to finish :

The process will be blocked until the job1 is finished.

Making a Curl request.

This is a very simple implementation for doing curl queries. It should be improved ! But well it can be built open the job executions.

You can of crouse pass some parameters and do a POST queries as well.

Having callbacks

Something else you can do is place callbacks on your jobs in order to have a function called when the job is done.

Custom settings

Yo have custom settings you must call

Before running initiating any jobs before, it needs to be your first call !!

The methods can take the fallowing parameters :

Stuff to now

Ignored variables :

All variables you set in a job is transfered to the new execution(thread) once the job starts and are then updated when to job finishes with the new values coming from the job. This varibles may be privete or public, they are going to be serialized and passed to the new execution. Once the execution finishes they will be serialized again and sent back to the main execution.

In some cases we may wish to have values available only on the main process or on the new execution. All variables prefixed by a double underscore("_") will be ignored during transfer.

Example :

TODO In the future


All versions of asynchronous-jobs with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.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 oliverde8/asynchronous-jobs contains the following files

Loading the files please wait ....