Download the PHP package vxm/laravel-async without Composer

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

Laravel Async


Latest version Build status Total download License

About it

A package provide an easy way to run code asynchronous and parallel base on Spatie Async wrapper for Laravel application.

Installation

Require Laravel Async using Composer:

The package will automatically register itself.

You can publish the config-file (optional) with:

This is the contents of the published config file:

Usage

Run async code

After install, now you can try run async code via Async facade:

An async job can be callable class, anonymous function or Laravel callback:

You can run multiple job one time and waiting until all done.

Event listeners

When creating asynchronous processes, you can add the following event hooks:

Working with complex job

When working with complex job you may want to setup more before it run (ex: job depend on Eloquent model). This package provide you an Artisan command make:async-job to generate a job template. By default, all of the async jobs for your application are stored in the app/AsyncJobs directory. If the app/AsyncJobs directory doesn't exist, it will be created. You may generate a new async job using the Artisan CLI:

After created it, you need to prepare your job structure, example:

In this example, note that we were able to pass an Eloquent model directly into the async job's constructor. Because of the SerializesModels trait that the job is using, Eloquent models will be gracefully serialized and unserialized when the job is processing. If your async job accepts an Eloquent model in its constructor, only the identifier for the model will be serialized onto the queue. When the job is actually handled, the system will automatically re-retrieve the full model instance from the database. It's all totally transparent to your application and prevents issues that can arise from serializing full Eloquent model instances.

The handle method is called when the job is processed in async process. Note that we are able to type-hint dependencies on the handle method of the job. The Laravel service container automatically injects these dependencies.

If you would like to take total control over how the container injects dependencies into the handle method, you may use the container's bindMethod method. The bindMethod method accepts a callback which receives the job and the container. Within the callback, you are free to invoke the handle method however you wish. Typically, you should call this method from a service provider:

Now run it asynchronously:

Compare with queue

You can feel this package look like queue and thing why not using queue?

Queue is a good choice for common async jobs. This package using in cases end-user need to get response in single request but it's a heavy things need to using several processes for calculation or IO heavy operations. And it no need to run a queue listener.


All versions of laravel-async with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0
spatie/async Version ^1.6
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 vxm/laravel-async contains the following files

Loading the files please wait ....