php giantbomb
1.0.0
이것은 GiantBomb의 API의 래퍼 역할을하는 라이브러리입니다.
작곡가를 통해
$ composer require dborsatto/php-giantbomb $ apiKey = ' YouApiKey ' ;
// Create a Config object and pass it to the Client
$ config = new DBorsatto GiantBomb Configuration ( $ apiKey );
$ client = new DBorsatto GiantBomb Client ( $ config );
// OPTIONAL: use a PSR-16 simple cache pool
$ cache = new Cache Adapter PHPArray ArrayCachePool ();
$ client = new DBorsatto GiantBomb Client ( $ config , $ cache );
// Standard query creation process
$ query = DBorsatto GiantBomb Query:: create ()
-> addFilterBy ( ' name ' , ' Uncharted ' )
-> sortBy ( ' original_release_date ' , ' asc ' )
-> setFieldList ([ ' id ' , ' name ' , ' deck ' ])
-> setParameter ( ' limit ' , ' 100 ' )
-> setParameter ( ' offset ' , ' 0 ' );
$ games = $ client -> find ( ' Game ' , $ query );
echo count ( $ games ). " Game objects loaded n" ;
// These two options are equivalent
$ game = $ client -> findOne ( ' Game ' , Query:: createForResourceId ( ' 3030-22420 ' ));
// The findWithResourceID method is just a shortcut
$ game = $ client -> findWithResourceID ( ' Game ' , ' 3030-22420 ' );
echo $ game -> get ( ' name ' ). " object loaded n" ;
// These two options are equivalent
$ query = DBorsatto GiantBomb Query:: create ()
-> setParameter ( ' query ' , ' Uncharted ' )
-> setParameter ( ' resources ' , ' game,franchise ' );
$ results = $ client -> find ( ' Search ' , $ query );
// The search method is just a shortcut
$ results = $ client -> search ( ' Uncharted ' , ' game,franchise ' );
echo count ( $ results ). " Search objects loaded n" ;전체 옵션 목록은 GiantBomb의 API 문서를 방문하십시오.
MIT 라이센스 (MIT). 자세한 내용은 라이센스 파일을 참조하십시오.