PHP code example of mattdanger / phalcon-semaphore

1. Go to this page and download the library: Download mattdanger/phalcon-semaphore library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mattdanger / phalcon-semaphore example snippets


$di->set('semaphore', '\PhalconSemaphore\Semaphore');

$di->set('semaphore', function() use ($config){
  return new \PhalconSemaphore\Semaphore('my_table_name');
}, true);


$this->semaphore->run(string $class, $string method, int $expiration_hours, array $args);

// Example without method parameters
$this->semaphore->run('MyNamespace\Models\Stat', 'calculate', 1);

// Example with method parameters
$this->semaphore->run('MyNamespace\Models\Stat', 'calculate', 1, array($arg1, $arg2, ...));