managlea / resource-handler
dev-master
2016-10-28 15:28 UTC
Requires
- php: >=7.0
- managlea/entity-manager: >=0.0.1
- managlea/resource-mapper: >=0.0.1
Requires (Dev)
- codeclimate/php-test-reporter: dev-master as 0.0.1
- phpunit/phpunit: >=5.2
This package is not auto-updated.
Last update: 2024-04-10 22:08:53 UTC
README
Package to provide wrapper for handling resources (resource as in RESTful APIs etc)
Basic usage
Read more about packages which are required by ResourceHandler
- Managlea/ResourceMapper - for mapping resources to objects
- Managlea/EntityManager - for getting objects from DB
// Create new EntityManagerFactory (instanceof Managlea\Component\EntityManagerFactoryInterface) $entityManagerFactory = new EntityManagerFactory(); // Create new ResourceMapper by passing $entityManagerFactory in as parameter $resourceMapper = ResourceMapper::initialize($entityManagerFactory); // Create new resourceHandler (by passing correct resourceMapper in as parameter) $resourceHandler = ResourceHandler::initialize($resourceMapper); // Get single foo object with id 1 $foo = $resourceHandler->getSingle('foo', 1); // Get collection of foos (by default 20 items, without any filters) $fooCollection = $resourceHandler->getCollection('foo');