Skip to content

Commit

Permalink
Merge d023996 into 03ec0ea
Browse files Browse the repository at this point in the history
  • Loading branch information
bakura10 committed Oct 15, 2013
2 parents 03ec0ea + d023996 commit b9354f4
Show file tree
Hide file tree
Showing 113 changed files with 1,675 additions and 5,473 deletions.
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,14 @@ php:
- 5.4
- 5.5

matrix:
allow_failures:
- php: 5.5

before_script:
- composer self-update
- composer update --prefer-source --dev

script:
- ./vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml --exclude-group Performance
- ./vendor/bin/phpunit --group=Functional
- ./vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/
- ./vendor/bin/phpcs --standard=PSR2 ./src/

after_script:
- php vendor/bin/coveralls -v
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.0.0

* Complete refactor, initial release (code cleaning, documentation...)

## 0.0.2

* Exclude request base path from path
Expand Down
33 changes: 4 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
ZfrRest
=======

[![Build Status](https://travis-ci.org/zf-fr/zfr-rest.png?branch=master)](https://travis-ci.org/zf-fr/zfr-rest) [![Coverage Status](https://coveralls.io/repos/zf-fr/zfr-rest/badge.png?branch=master)](https://coveralls.io/r/zf-fr/zfr-rest?branch=master) [![Dependency Status](https://www.versioneye.com/package/php--zfr--zfr-rest/badge.png)](https://www.versioneye.com/package/php--zfr--zfr-rest)

Version 0.1.0 ([changelog](/CHANGELOG.md))

**[READ MORE ABOUT CURRENT STATUS](https://github.com/zf-fr/ZfrRest/issues/41)**

## Is ZfrRest usable ?

Current features of ZfrRest work well and ZfrRest is definitely usable for simple cases. However, please note that
we have many more features to come for more complex applications. Those changes may (well, for sure they will) break
the API at some point, but we will keep track of all the changes in the [UPGRADE](UPGRADE.md) guide.

Ultimately, you are strongly encouraged to test the module and report feedbacks, PR...

## Milestone

Here is a basic roadmap of ZfrRest, by priority:

1. Finish the work on the ResourceGraphRoute, especially the assemble method.
2. Better architecture for extracting/hydrating data, to especially allow to configure key names, payload structure...
(so that integrate ZfrRest with a MVC framework that has specific conventions to be as easy as write an adapter).
3. Add support for HATEOAS links.
4. Improve the performance (using proxy maybe useful in some places)
5. Cleanup the code
[![Build Status](https://travis-ci.org/zf-fr/zfr-rest.png?branch=master)](https://travis-ci.org/zf-fr/zfr-rest)
[![Coverage Status](https://coveralls.io/repos/zf-fr/zfr-rest/badge.png?branch=master)](https://coveralls.io/r/zf-fr/zfr-rest?branch=master)
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/zf-fr/zfr-rest/badges/quality-score.png?s=78ed408c927e01cb27ab7f3cc04349a770132550)](https://scrutinizer-ci.com/g/zf-fr/zfr-rest/)
[![Dependency Status](https://www.versioneye.com/package/php--zfr--zfr-rest/badge.png)](https://www.versioneye.com/package/php--zfr--zfr-rest)

## Installation

Expand All @@ -36,8 +16,3 @@ Then, add the keys "ZfrRest" to your modules list in `application.config.php` fi
`zfr_rest.global.php.dist` into your `autoload` folder (don't forget to remove the .dist extension at the end!). For
more details about how to use ZfrRest, please follow the [quick start](/docs/quick-start/01-introduction.md).

## Documentation

* [Quick Start](/docs/quick-start/01-introduction.md)
* [Annotation mapping reference](/docs/annotation-mapping-reference.md)
* [Cook book](/docs/cook-book.md)
5 changes: 0 additions & 5 deletions UPGRADE.md

This file was deleted.

10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"minimum-stability": "dev",
"require": {
"php": ">=5.3.3",
"symfony/serializer": ">=2.1",
"jms/metadata": ">=1.3",
"zendframework/zendframework": ">=2.2",
"doctrine/common": ">=2.3",
"symfony/serializer": "~2.2",
"jms/metadata": "dev-master",
"zendframework/zendframework": "~2.2",
"doctrine/common": "~2.4",
"doctrine/doctrine-module": "~0.8"
},
"require-dev": {
Expand All @@ -43,7 +43,7 @@
"ZfrRest\\": "src/"
},
"classmap": [
"./Module.php"
"./"
]
}
}
102 changes: 16 additions & 86 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,56 +17,25 @@
*/

return array(
/**
* SERVICE MANAGER CONFIG
*/
'service_manager' => array(
'invokables' => array(
'ZfrRest\Mvc\HttpExceptionListener' => 'ZfrRest\Mvc\HttpExceptionListener',
'ZfrRest\Mvc\HttpMethodOverrideListener' => 'ZfrRest\Mvc\HttpMethodOverrideListener',
'factories' => array(
'ZfrRest\Mvc\Router\Http\Matcher\BaseSubPathMatcher' => 'ZfrRest\Factory\BaseSubPathMatcherFactory',
'ZfrRest\Options\ModuleOptions' => 'ZfrRest\Factory\ModuleOptionsFactory',
'ZfrRest\Resource\Metadata\ResourceMetadataFactory' => 'ZfrRest\Factory\ResourceMetadataFactoryFactory'
),

'factories' => array(
'ZfrRest\Mvc\View\Http\SelectModelListener' => 'ZfrRest\Factory\SelectModelListenerFactory',
'ZfrRest\Options\ModuleOptions' => 'ZfrRest\Factory\ModuleOptionsFactory',
'ZfrRest\Resource\Metadata\CacheProvider' => 'ZfrRest\Factory\ResourceMetadataCacheFactory',
'ZfrRest\Resource\Metadata\MetadataFactory' => 'ZfrRest\Factory\ResourceMetadataFactoryFactory',
'ZfrRest\Serializer\DecoderPluginManager' => 'ZfrRest\Factory\DecoderPluginManagerFactory',
'ZfrRest\View\Model\ModelPluginManager' => 'ZfrRest\Factory\ModelPluginManagerFactory',
'ZfrRest\Mvc\View\Http\CreateResourcePayloadListener'
=> 'ZfrRest\Factory\CreateResourcePayloadListenerFactory',
)
),

'console' => array(
'router' => array(
'routes' => array(
'clear-cache' => array(
'type' => 'Simple',
'options' => array(
'route' => 'rest clear metadata cache',
'defaults' => array(
'controller' => 'ZfrRest\Controller\Cache',
'action' => 'clear-cache'
)
),
),
)
)
),

'controllers' => array(
'invokables' => array(
'ZfrRest\Controller\Cache' => 'ZfrRest\Controller\CacheController',
)
),

'hydrators' => array(
'factories' => array(
'ZfrRest\Stdlib\Hydrator\PaginatorHydrator' => 'ZfrRest\Factory\PaginatorHydratorFactory'
),
'aliases' => array(
'PaginatorHydrator' => 'ZfrRest\Stdlib\Hydrator\PaginatorHydrator'
'ZfrRest\Mvc\Router\Http\Matcher\AssociationSubPathMatcher' => 'ZfrRest\Mvc\Router\Http\Matcher\AssociationSubPathMatcher',
'ZfrRest\Mvc\Router\Http\Matcher\CollectionSubPathMatcher' => 'ZfrRest\Mvc\Router\Http\Matcher\CollectionSubPathMatcher',
)
),

/**
* ROUTE PLUGIN MANAGER
*/
'route_manager' => array(
'factories' => array(
'ZfrRest\Mvc\Router\Http\ResourceGraphRoute' => 'ZfrRest\Factory\ResourceGraphRouteFactory'
Expand All @@ -77,47 +46,8 @@
),
),

'view_manager' => array(
'strategies' => array(
'ViewJsonStrategy'
)
),

'zfr_rest' => array(
/**
* Listeners options
*/
'listeners' => array(
'register_http_exception' => true,
'register_create_resource_payload' => true,
'register_select_model' => true,
'register_http_method_override' => false
),

/**
* Which behaviours each controller should automatically do for us?
*/
'controller_behaviours' => array(
'auto_validate' => true,
'auto_hydrate' => true
),

/**
* Resource metadata options
*/
'resource_metadata' => array(
'cache' => 'Doctrine\Common\Cache\ArrayCache',
'drivers' => array()
),

/**
* Set DecoderPluginManager
*/
'decoders' => array(),

/**
* Set ModelPluginManager
*/
'models' => array()
)
/**
* ZFR REST CONFIG
*/
'zfr_rest' => array()
);
106 changes: 13 additions & 93 deletions config/zfr_rest.global.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -14,102 +14,22 @@ return array(
'object_manager' => 'doctrine.entitymanager.orm_default',

/**
* Listeners options
* FQCN of the Metadata cache provider used for caching the mapping. It must returns an instance of
* \Metadata\Cache\CacheInterface
*/
'listeners' => array(
/**
* If this listener is registered (it is by default), then any exceptions that could be thrown
* in controller is serialized to the proper format extracted from Content-Type header.
*/
// 'register_http_exception' => true,

/**
* If this listener is registered (it is not by default), it will check if the request contains
* a header "X-HTTP-Method-Override". This header allows to change the HTTP verb. This is useful in
* some contexts (for instance, some companies' proxies only allow GET and POST methods)
*/
// 'register_http_method_override' => false,

/**
* If this listener is registered, it allows you to return an object (an entity, for instance) from a
* controller's action, and automatically create payload from its content. Please note that if you deactivate
* this listener, you MUST NOT return a resource (entity...) from your controller, but an array or Model
*/
// 'register_create_resource_payload' => true,

/**
* If this listener is registered (it is by default), please note that if you deactivate this listener,
* then you need to return a concrete ModelInterface object (ViewModel, JsonModel...) from your actions,
* or manually use the AcceptableViewModelSelector to return the right model according to Content-Type
*/
// 'register_select_model' => true,
),

/**
* Which behaviours each controller should automatically do for us?
*/
'controller_behaviours' => array(
/**
* If this is set to true (it is by default), then controller will automatically instantiate the
* input filter specified in resource metadata (if there is one) - from service locator first, or
* directly instantiate it if not found -, and validate data. If data is incorrect, it will return
* a 400 HTTP error (Bad Request) with the failed validation messages in it).
*/
// 'auto_validate' => true,

/**
* If this is set to true (it is by default), then controller will automatically instantiate the hydrator
* specified in resource metadata (if there is one) - from service locator first, or directly instantiate
* it if not found - and hydrate resource object with previously validated data.
*
* Please note that for security reason, if you activate this option, you SHOULD NOT deactivate auto
* validation UNLESS you validate data yourself.
*/
// 'auto_hydrate' => true
),

/**
* Resource metadata options
*/
'resource_metadata' => array(
/**
* Set the FQCN of the Doctrine cache provider to use. For performance reasons, you should ALWAYS
* set an efficient cache that is persistent across requests (like APC or Memcached caches), but for
* development purposes you can keep the default array cache
*/
// 'cache' => 'Doctrine\Common\Cache\ArrayCache',

/**
* Specify the resource metadata drivers. This is used by ZfrRest to extract your mapping. Currently two
* methods are supported: PHP files and annotations. In order to keep your code clean, we recommand you
* to add your drivers into each module config.
*
* To add a annotation driver:
*
* 'application_driver' => array(
* 'class' => 'ZfrRest\Resource\Metadata\Driver\AnnotationDriver',
* 'paths' => array(__DIR__ . '/../src/Application/Entity')
* )
*
* To add a PHP driver:
*
* 'application_driver' => array(
* 'class' => 'ZfrRest\Resource\Metadata\Driver\PhpDriver',
* 'paths' => array(__DIR__ . '/../src/Application/Entity')
* )
*/
// 'drivers' => array()
),

/**
* This configuration allow to add classes to the DecoderPluginManager
*/
'decoders' => array(),
'cache' => '',

/**
* This configuration allow to add classes to the ModelPluginManager. This works like any other
* plugin manager
*
* Specify the resource metadata drivers. This is used by ZfrRest to extract your mapping. Currently one
* method is supported: annotations.
*
* To add an annotation driver:
*
* 'application_driver' => array(
* 'class' => 'ZfrRest\Resource\Metadata\Driver\AnnotationDriver'
* )
*/
'models' => array()
'drivers' => array(),
)
);
Loading

0 comments on commit b9354f4

Please sign in to comment.