PHP code example of mathsgod / graphqlite-laminas-paginator-type
1. Go to this page and download the library: Download mathsgod/graphqlite-laminas-paginator-type library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mathsgod / graphqlite-laminas-paginator-type example snippets
use Laminas\Paginator\Mappers\TypeMapperFactory;
use TheCodingMachine\GraphQLite\SchemaFactory;
$factory = new SchemaFactory($cache, $container);
$factory->addTypeMapperFactory(new TypeMapperFactory); // add type mapper
//Controller class
class Root{
#[Query()]
/**
* @return Product[]
*/
function products():Paginator{
//get the products paginator
return $paginator;
}
}
//Type class
#[Type]
class Product{
#[Field]
public string $name
}