mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
make better use of composer across php-resque
* recommend php-resque be installed via Composer * provide quick getting started steps * move ./resque.php to bin/resque, make it available as a Composer bin * have classes autoloaded via Composer (or some other means if not using Composer)
This commit is contained in:
parent
8d6da21473
commit
2f5b48930f
13 changed files with 103 additions and 43 deletions
|
@ -3,8 +3,8 @@ if(empty($argv[1])) {
|
|||
die('Specify the ID of a job to monitor the status of.');
|
||||
}
|
||||
|
||||
require '../lib/Resque/Job/Status.php';
|
||||
require '../lib/Resque.php';
|
||||
require __DIR__ . '/init.php';
|
||||
|
||||
date_default_timezone_set('GMT');
|
||||
Resque::setBackend('127.0.0.1:6379');
|
||||
|
||||
|
|
25
demo/init.php
Normal file
25
demo/init.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
// Find and initialize Composer
|
||||
// NOTE: You should NOT use this when developing against php-resque.
|
||||
// The autoload code below is specifically for this demo.
|
||||
$files = array(
|
||||
__DIR__ . '/../../vendor/autoload.php',
|
||||
__DIR__ . '/../../../../autoload.php',
|
||||
__DIR__ . '/../vendor/autoload.php',
|
||||
);
|
||||
|
||||
$found = false;
|
||||
foreach ($files as $file) {
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists('Composer\Autoload\ClassLoader', false)) {
|
||||
die(
|
||||
'You need to set up the project dependencies using the following commands:' . PHP_EOL .
|
||||
'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
|
||||
'php composer.phar install' . PHP_EOL
|
||||
);
|
||||
}
|
|
@ -3,7 +3,7 @@ if(empty($argv[1])) {
|
|||
die('Specify the name of a job to add. e.g, php queue.php PHP_Job');
|
||||
}
|
||||
|
||||
require '../lib/Resque.php';
|
||||
require __DIR__ . '/init.php';
|
||||
date_default_timezone_set('GMT');
|
||||
Resque::setBackend('127.0.0.1:6379');
|
||||
|
||||
|
|
|
@ -4,5 +4,5 @@ require 'bad_job.php';
|
|||
require 'job.php';
|
||||
require 'php_error_job.php';
|
||||
|
||||
require '../resque.php';
|
||||
require '../bin/resque';
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue