Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed composer autoloading usage #41

Merged
merged 5 commits into from
Oct 12, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
.project
.buildpath
.settings/
vendor/
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

17 changes: 3 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
VENDOR = vendor
COMPONENTS = $(VENDOR)/symfony/Symfony/Component
CLASS_LOADER = $(COMPONENTS)/ClassLoader/UniversalClassLoader.php

all: $(CLASS_LOADER)

$(CLASS_LOADER):
git submodule init
git submodule update

test: all
test:
phpunit


benchmark: all
benchmark:
@echo "Publishing 4000 msgs with 1KB of content:"
php benchmark/producer.php 4000
@echo "Consuming 4000:"
php benchmark/consumer.php
php benchmark/consumer.php
4 changes: 2 additions & 2 deletions PhpAmqpLib/Tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

include_once(__DIR__.'/../../demo/autoload.php');
include_once(__DIR__.'/config.php');
require_once __DIR__.'/../../vendor/autoload.php';
require_once __DIR__.'/config.php';
3 changes: 2 additions & 1 deletion PhpAmqpLib/Tests/config.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

define('HOST', 'localhost');
define('PORT', 5672);
define('USER', 'phpamqplib');
define('PASS', 'phpamqplib_password');
define('VHOST', 'phpamqplib_testbed');
define('AMQP_DEBUG', false);
define('AMQP_DEBUG', false);
26 changes: 3 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ Get the library source code:

$ git clone git://github.com/videlalvaro/php-amqplib.git

This library uses the `Symfony` default `UniversalClassLoader` so you will have to run the following command to download it as a submodule:
Class autoloading and dependencies are managed by `composer` so install it:

$ make
$ curl --silent https://getcomposer.org/installer | php
$ php composer.phar install

## Usage ##

Expand Down Expand Up @@ -63,25 +64,6 @@ If you need to listen to the sockets used to connect to RabbitMQ then see the ex
- `amqp_consumer_fanout_{1,2}.php` and `amqp_publisher_fanout.php`: demoes fanout exchanges with named queues.
- `basic_get.php`: demoes obtaining messages from the queues by using the _basic get_ AMQP call.

## Loading Classes ##

The library uses the [Symfony ClassLoader component](https://github.com/symfony/ClassLoader) in order to use a standard way of class loading.

If you want to see how to use the component with this library you can take a look at the file `demo/autoload.php`:

<?php

require_once(__DIR__ . '/../vendor/symfony/Symfony/Component/ClassLoader/UniversalClassLoader.php');

use Symfony\Component\ClassLoader\UniversalClassLoader;

$loader = new UniversalClassLoader();
$loader->registerNamespaces(array(
'PhpAmqpLib' => __DIR__ . '/..',
));

$loader->register();

## Debugging ##

If you want to know what's going on at a protocol level then add the following constant to your code:
Expand Down Expand Up @@ -135,5 +117,3 @@ For bug reports, please use bug tracking system at the project page.
Patches are very welcome!

Author: Vadim Zaliva <lord@crocodile.org>


7 changes: 4 additions & 3 deletions benchmark/config.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?php
include_once(__DIR__.'/../demo/autoload.php');

require_once __DIR__.'/../vendor/autoload.php';

define('HOST', 'localhost');
define('PORT', 5672);
define('USER', 'guest');
define('PASS', 'guest');
define('VHOST', '/');

//If this is enabled you can see AMQP output on the CLI
define('AMQP_DEBUG', false);
// If this is enabled you can see AMQP output on the CLI
define('AMQP_DEBUG', false);
3 changes: 3 additions & 0 deletions bin/ci/before_build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/sh

curl --silent https://getcomposer.org/installer | php
php composer.phar install

# phpamqplib:phpamqplib_password has full access to phpamqplib_testbed

sudo rabbitmqctl add_vhost phpamqplib_testbed
Expand Down
12 changes: 0 additions & 12 deletions demo/autoload.php

This file was deleted.

5 changes: 3 additions & 2 deletions demo/basic_return.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

require_once __DIR__.'/../vendor/autoload.php';

use PhpAmqpLib\Message\AMQPMessage;
use PhpAmqpLib\Connection\AMQPConnection;

require_once('autoload.php');

$connection = new AMQPConnection('localhost', 5672, 'guest', 'guest');
$channel = $connection->channel();

Expand Down
3 changes: 2 additions & 1 deletion demo/config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
include_once(__DIR__.'/autoload.php');

require_once __DIR__.'/../vendor/autoload.php';

define('HOST', 'localhost');
define('PORT', 5672);
Expand Down
1 change: 0 additions & 1 deletion vendor/symfony/Symfony/Component/ClassLoader
Submodule ClassLoader deleted from 5cd07e