php-extended / php-api-endpoint-csv-object
A library that implements the php-extended/php-api-endpoint-csv-interface library
5.0.0
2022-12-18 14:59 UTC
Requires
Requires (Dev)
README
A library that implements the php-extended/php-api-endpoint-csv-interface library.
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download
composer.phar
from their website. - Then run the following command to install this library as dependency :
php composer.phar php-extended/php-api-endpoint-csv-object": "^5"
Basic Usage
This library is made to be extended. The base Endpoint implementation is a generic object that is made to ease the transform into a really useful endpoint that may be something like :
use PhpExtended\Endpoint\LocalCsvEndpoint;
class MyEndpoint extends LocalCsvEndpoint
{
/**
* @return \Iterator<Foo>
*/
public function getFoos() : \Iterator
{
return $this->getObject(Foo::class, __DIR__.'/foos.csv');
}
}
Where __DIR__./'foos.csv'
is a file that contains a foo per row of csv
data, where the fields are in order with the constructor.
License
MIT (See license file).