Skip to content

Commit

Permalink
Merge pull request #9 from ycombinator/master
Browse files Browse the repository at this point in the history
Make this project usable via Composer
  • Loading branch information
mikemccabe committed Jan 5, 2015
2 parents 0e342fd + 877aa64 commit b3af30a
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
\#*
.idea
.fuse*
vendor/
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ php:
- 5.6
- hhvm

before_script:
- composer install --prefer-source

script: php run_tests.php
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,31 @@ Implements IETF JSON-patch (RFC 6902) and JSON-pointer (RFC 6901):
http://tools.ietf.org/html/rfc6902
http://tools.ietf.org/html/rfc6901

Using with Composer
-------------------

To use this library as a Composer dependency in your project, include the
following sections in your project's `composer.json` file:

```
"repositories": [
{
"type": "vcs",
"url": "https://github.com/mikemccabe/json-patch-php"
}
],
"require": {
"mikemccabe/json-patch-php": "dev-master"
}
```

Then, in your project's code, use the `JsonPatch` class definition from
the `mikemccabe\JsonPatch` namespace like so:

```php
use mikemccabe\JsonPatch\JsonPatch;
```

Entry points
------------

Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
"name": "mikemccabe/json-patch-php",
"description": "Produce and apply json-patch objects",
"type": "library",
"license": "LGPL-3.0"
"license": "LGPL-3.0",
"autoload": {
"psr-4": {
"mikemccabe\\JsonPatch\\": "src"
}
}
}
4 changes: 3 additions & 1 deletion run_tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
// This is a simple jig for testing JsonPatch.inc against json-encoded
// test files.

require_once('JsonPatch.inc');
require 'vendor/autoload.php';

use mikemccabe\JsonPatch\JsonPatch;

$verbose = false;

Expand Down
3 changes: 2 additions & 1 deletion JsonPatch.inc → src/JsonPatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@
*/

namespace mikemccabe\JsonPatch;

class JsonPatchException extends Exception { }
class JsonPatchException extends \Exception { }


class JsonPatch
Expand Down

0 comments on commit b3af30a

Please sign in to comment.