managlea/resource-handler

dev-master 2016-10-28 15:28 UTC

This package is not auto-updated.

Last update: 2024-09-26 00:09:28 UTC


README

提供处理资源的包装器(资源如RESTful API等)的包

Scrutinizer Code Quality Build Status Code Coverage
Code Climate Test Coverage
SensioLabsInsight
Codacy Badge
Build Status Circle CI
PHP-Eye

基本用法

了解更多关于ResourceHandler所需的包

// 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');