2017 © Pedro Peláez
 

library itemcodes

image

germania-kg/itemcodes

  • Thursday, April 12, 2018
  • by germania-kg
  • Repository
  • 2 Watchers
  • 0 Stars
  • 61 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

Germania KG · ItemCodes

Packagist PHP version Build Status Scrutinizer Code Quality Code Coverage Build Status, (*1)

Installation with Composer

$ composer require germania-kg/itemcodes

Make sure the itemcodes table exists; see Database section., (*2)

Database

Setup the MySQL table itemcodes as described in sql/itemcodes.sql.txt. Rename the table if needed., (*3)

Usage

ItemCode

<?php
use Germania\Nav\ItemCodes\ItemCode;

$itemcode = new ItemCode;
$itemcode->setCode("COD")->setName("The Code Name");

InsertOrUpdateItemCode

This action class requires at least a PDO handle an a table name to work with. A PSR-3 Logger is optional., (*4)

<?php
use Germania\Nav\ItemCodes\Actions\InsertOrUpdateItemCode;

// Setup ingredients
$pdo = new \PDO( ... );
$table = "my_itemcodes";

// Optional PSR-3 Logger
$logger = ...

$inserter = new InsertOrUpdateItemCode( $pdo, $table);
$inserter = new InsertOrUpdateItemCode( $pdo, $table, $logger);

// Both are equal:
$result = $insert_or_update( $itemcode );
$result = $insert_or_update->execute( $itemcode );

// $result is 1 when ItemCode has been INSERTed,
// and 2, when REPLACEd

Issues

See issues list., (*5)

Development

$ git clone https://github.com/GermaniaKG/ItemCodes.git
$ cd ItemCodes
$ 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:, (*6)

$ composer test
# or
$ vendor/bin/phpunit

The Versions

12/04 2018
12/04 2018
17/10 2017
09/10 2017
09/10 2017
09/10 2017
09/10 2017