germania-kg/worlds

3.1.1 2022-08-18 13:39 UTC

This package is auto-updated.

Last update: 2024-12-18 18:34:11 UTC


README

A World is a theoretical concept to put similar products into a common theoretical drawer, somehow.

Packagist PHP version Build Status Scrutinizer Code Quality Code Coverage Build Status

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