germania-kg / worlds
3.1.1
2022-08-18 13:39 UTC
Requires
- php: ^7.3|^8.0
- psr/container: ^1.0|^2.0
Requires (Dev)
- php-coveralls/php-coveralls: ^2.0
- phpspec/prophecy: ^1.0
- phpunit/phpunit: ^9.0
- pimple/pimple: ^3.0
README
A World is a theoretical concept to put similar products into a common theoretical drawer, somehow.
Installation with Composer
$ 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.
Usage
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(); ?>
Issues
See issues list.
Development
$ git clone https://github.com/GermaniaKG/Worlds.git
$ cd Worlds
$ composer install
Unit tests
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