A World is a theoretical concept to put similar products into a common theoretical drawer, somehow.
$ composer require germania-kg/worlds
MySQL: This package requires a MySQL table germania_world which you can install using germania_world.sql
in sql/
directory.
The Worlds class reads all worlds from the database. Its WorldsInterface extends the container-interop (upcoming PSR 11 standard) as well as IteratorAggregate, and SPL Countable.
To retrieve a single World instance:
<?php
$worlds = new Germania\Worlds\Worlds( $pdo );
// Use either ID or URL slug
$check = $worlds->has( 'my_world' );
$check = $worlds->has( 42 );
// Use either ID or URL slug
$my_world = $worlds->get( 'my_world' );
$my_world = $worlds->get( 42 );
echo $my_world->getName();
?>
See issues list.
$ git clone https://github.com/GermaniaKG/Worlds.git
$ cd Worlds
$ composer install
Either copy phpunit.xml.dist
to phpunit.xml
and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:
$ composer test
# or
$ vendor/bin/phpunit