2017 © Pedro Peláez
 

library non-blocking-php

image

devbabuind/non-blocking-php

  • Tuesday, January 3, 2017
  • by devbabuind
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

non-blocking-php

Library for non blocking background jobs in PHP, (*1)

Installation

Install composer in your project:, (*2)

curl -s https://getcomposer.org/installer | php

Create a composer.json file in your project root:, (*3)

{
    "require": {
        "devbabuind/non-blocking-php": "dev-master"
    }
}

Install via composer:, (*4)

php composer.phar install

Basic Usage

Hello World

Add this line to your application's index.php file:, (*5)

require 'vendor/autoload.php';

Import the required classes into your namespace:, (*6)

use DevBabuInd\NonBlockingPHP\Execute;

Instantiate a new Execute:, (*7)

$execute = new Execute(array('autoMode' => true));

Add some parameters:, (*8)

$query_params = array('foo'=>'bar');
$folder_protection = array('username' => 'test', 'password' => 'test');
/* sample parameters */
$params = array(
    'url' => 'http://www.yourappdomain.com/job.php',
    'command' => 'php /folderpathofyourapp/job.php',
    'auth' => $folder_protection,
    'args' => $query_params
);

Now run the job:, (*9)

$result = $execute->run($params);

You can get the output:, (*10)

if ($result) {
    echo "Yay! Background call initiated";
} else {
    print_r($execute->getError());
}

The Versions

03/01 2017

dev-master

9999999-dev

  Sources   Download

MIT

by Babu M

03/01 2017

dev-docsupdate

dev-docsupdate

  Sources   Download

MIT

by Babu M