Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rm sf classloader, recommend composer, test against 5.4

  • Loading branch information...
commit e209fc586b8709d35303ba1fee32d7e6ef7ece4e 1 parent de6425f
@igorw authored
View
2  .gitignore
@@ -0,0 +1,2 @@
+composer.lock
+vendor
View
3  .gitmodules
@@ -1,3 +0,0 @@
-[submodule "vendor/symfony/Component/ClassLoader"]
- path = vendor/symfony/Component/ClassLoader
- url = https://github.com/symfony/ClassLoader.git
View
11 .travis.yml
@@ -1,4 +1,11 @@
language: php
-php: 5.3.8
-before_script: git submodule update --init
+
+php:
+ - 5.3
+ - 5.4
+
+before_script:
+ - wget http://getcomposer.org/composer.phar
+ - php composer.phar install
+
script: phpunit
View
56 README.md
@@ -1,5 +1,4 @@
-Événement
-=========
+# Événement
Événement is a very simple event dispatching library for PHP 5.3.
@@ -12,8 +11,35 @@ It is very strongly inspired by the EventEmitter API found in
[![Build Status](https://secure.travis-ci.org/igorw/evenement.png)](http://travis-ci.org/igorw/evenement)
-Creating an Emitter
--------------------
+## Fetch
+
+The recommended way to install Événement is [through composer](http://packagist.org).
+
+Just create a composer.json file for your project:
+
+```JSON
+{
+ "require": {
+ "evenement/evenement": "*"
+ }
+}
+```
+
+And run these two commands to install it:
+
+ $ wget http://getcomposer.org/composer.phar
+ $ php composer.phar install
+
+Now you can add the autoloader, and you will have access to the library:
+
+```php
+<?php
+require 'vendor/.composer/autoload.php';
+```
+
+## Usage
+
+### Creating an Emitter
```php
<?php
@@ -21,8 +47,7 @@ require __DIR__.'/vendor/evenement/src/Evenement/EventEmitter.php';
$emitter = new Evenement\EventEmitter();
```
-Adding Listeners
-----------------
+### Adding Listeners
```php
<?php
@@ -31,10 +56,25 @@ $emitter->on('user.create', function (User $user) use ($logger) {
});
```
-Emitting Events
----------------
+### Emitting Events
```php
<?php
$emitter->emit('user.create', array($user));
```
+
+Tests
+-----
+
+Before running the tests you need to have composer set up an autoloader:
+
+ $ wget http://getcomposer.org/composer.phar
+ $ php composer.phar install
+
+Now you can run the unit tests.
+
+ $ phpunit
+
+License
+-------
+MIT, see LICENSE.
View
30 tests/bootstrap.php
@@ -1,17 +1,29 @@
<?php
/*
- * This file is part of the Silex framework.
+ * This file is part of Evenement.
*
- * (c) Fabien Potencier <fabien@symfony.com>
+ * Copyright (c) 2011 Igor Wiedler
*
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is furnished
+ * to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
*/
-require_once __DIR__.'/../vendor/symfony/Component/ClassLoader/UniversalClassLoader.php';
-
-$loader = new Symfony\Component\ClassLoader\UniversalClassLoader();
-$loader->registerNamespace('Evenement', __DIR__.'/../src');
-$loader->registerNamespace('Evenement\Tests', __DIR__);
+$loader = require __DIR__.'/../vendor/.composer/autoload.php';
+$loader->add('Evenement\Tests', __DIR__);
$loader->register();
1  vendor/symfony/Component/ClassLoader
@@ -1 +0,0 @@
-Subproject commit 33066c11cc23498409eb2a699474761b14deca37
Please sign in to comment.
Something went wrong with that request. Please try again.