Browse files

added composer support and autoloading

  • Loading branch information...
1 parent 3d2678a commit 790f7c50ddfeca188f0a09a4b59e30189e49afef @zircote zircote committed May 10, 2012
View
3 .gitignore
@@ -1 +1,2 @@
-lib/php-amqplib
+vendor
+composer.lock
View
9 Makefile
@@ -1,9 +0,0 @@
-VENDOR = vendor
-COMPONENTS = $(VENDOR)/symfony/Symfony/Component
-CLASS_LOADER = $(COMPONENTS)/ClassLoader/UniversalClassLoader.php
-
-all: $(CLASS_LOADER)
-
-$(CLASS_LOADER):
- git submodule init
- git submodule update
View
4 README.md
@@ -6,7 +6,9 @@ Inside the _examples_ folder you can see how to implement RPC, parallel processi
INSTALLATION
-Clone this project and then just run `make` to fetch the dependencies.
+@see http://getcomposer.org for composer details.
+
+Clone this project and then just run `composer update` to fetch the dependencies.
This project requires the php-amqplib library.
View
20 composer.json
@@ -0,0 +1,20 @@
+{
+ "name": "videlalvaro/Thumper",
+ "type": "library",
+ "description": "AMQP Tools",
+ "keywords": ["library", "AMQP", "RabbitMQ", "PHPAMQPLib", "Thumper"],
+ "homepage": "git://github.com/videlalvaro/Thumper.git",
+ "autoload": {
+ "psr-0": {"Thumper": "lib"}
+ },
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "git://github.com/videlalvaro/php-amqplib.git"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.3",
+ "videlalvaro/php-amqplib" : "master-dev"
+ }
+}
View
12 config/autoload.php
@@ -1,12 +0,0 @@
-<?php
-
-require_once(__DIR__ . '/../vendor/symfony/Symfony/Component/ClassLoader/UniversalClassLoader.php');
-
-use Symfony\Component\ClassLoader\UniversalClassLoader;
-
-$loader = new UniversalClassLoader();
-$loader->registerNamespaces(array(
- 'PhpAmqpLib' => __DIR__ . '/../vendor/videlalvaro/php-amqplib',
- ));
-
-$loader->register();
View
2 config/config.php
@@ -1,5 +1,5 @@
<?php
-
+require_once dirname(__DIR__) . '/vendor/autoload.php';
define('HOST', 'localhost');
define('PORT', 5672);
define('USER', 'guest');
View
4 examples/parallel_processing/char_count_server.php
@@ -1,8 +1,6 @@
<?php
-require_once(__DIR__ . '/../../config/autoload.php');
-require_once(__DIR__ . '/../../config/config.php');
-require_once(__DIR__ . '/../../lib/Thumper/RpcServer.php');
+require_once(dirname(dirname(__DIR__)) . '/config/config.php');
$charCount = function($word)
{
View
4 examples/parallel_processing/parallel_rpc.php
@@ -1,8 +1,6 @@
<?php
-require_once(__DIR__ . '/../../config/autoload.php');
-require_once(__DIR__ . '/../../config/config.php');
-require_once(__DIR__ . '/../../lib/Thumper/RpcClient.php');
+require_once(dirname(dirname(__DIR__)) . '/config/config.php');
$start = time();
View
4 examples/parallel_processing/random_int_server.php
@@ -1,8 +1,6 @@
<?php
-require_once(__DIR__ . '/../../config/autoload.php');
-require_once(__DIR__ . '/../../config/config.php');
-require_once(__DIR__ . '/../../lib/Thumper/RpcServer.php');
+require_once(dirname(dirname(__DIR__)) . '/config/config.php');
$randomInt = function($data)
{
View
4 examples/queue_server/consumer.php
@@ -1,8 +1,6 @@
<?php
-require_once(__DIR__ . '/../../config/autoload.php');
-require_once(__DIR__ . '/../../config/config.php');
-require_once(__DIR__ . '/../../lib/Thumper/Consumer.php');
+require_once(dirname(dirname(__DIR__)) . '/config/config.php');
$myConsumer = function($msg)
{
View
4 examples/queue_server/producer.php
@@ -1,8 +1,6 @@
<?php
-require_once(__DIR__ . '/../../config/autoload.php');
-require_once(__DIR__ . '/../../config/config.php');
-require_once(__DIR__ . '/../../lib/Thumper/Producer.php');
+require_once(dirname(dirname(__DIR__)) . '/config/config.php');
$producer = new Producer(HOST, PORT, USER, PASS, VHOST);
$producer->setExchangeOptions(array('name' => 'hello-exchange', 'type' => 'direct'));
View
4 examples/rpc/rpc_client.php
@@ -1,8 +1,6 @@
<?php
-require_once(__DIR__ . '/../../config/autoload.php');
-require_once(__DIR__ . '/../../config/config.php');
-require_once(__DIR__ . '/../../lib/Thumper/RpcClient.php');
+require_once(dirname(dirname(__DIR__)) . '/config/config.php');
$client = new RpcClient(HOST, PORT, USER, PASS, VHOST);
$client->initClient();
View
4 examples/topic/anon_consumer.php
@@ -1,8 +1,6 @@
<?php
-require_once(__DIR__ . '/../../config/autoload.php');
-require_once(__DIR__ . '/../../config/config.php');
-require_once(__DIR__ . '/../../lib/Thumper/AnonConsumer.php');
+require_once(dirname(dirname(__DIR__)) . '/config/config.php');
$myConsumer = function($msg)
{
View
4 examples/topic/topic_consumer.php
@@ -1,8 +1,6 @@
<?php
-require_once(__DIR__ . '/../../config/autoload.php');
-require_once(__DIR__ . '/../../config/config.php');
-require_once(__DIR__ . '/../../lib/Thumper/Consumer.php');
+require_once(dirname(dirname(__DIR__)) . '/config/config.php');
$myConsumer = function($msg)
{
View
4 examples/topic/topic_producer.php
@@ -1,8 +1,6 @@
<?php
-require_once(__DIR__ . '/../../config/autoload.php');
-require_once(__DIR__ . '/../../config/config.php');
-require_once(__DIR__ . '/../../lib/Thumper/Producer.php');
+require_once(dirname(dirname(__DIR__)) . '/config/config.php');
$producer = new Producer(HOST, PORT, USER, PASS, VHOST);
$producer->setExchangeOptions(array('name' => 'logs-exchange', 'type' => 'topic'));
1 vendor/symfony/Symfony/Component/ClassLoader
@@ -1 +0,0 @@
-Subproject commit 0e6ee8d07dda6920106048247d41249201604e76
1 vendor/videlalvaro/php-amqplib
@@ -1 +0,0 @@
-Subproject commit b74879109f8f79aed336b95e723e41674bafdebc

0 comments on commit 790f7c5

Please sign in to comment.