germania-kg/users-retailers

1.0.8 2022-03-30 10:24 UTC

This package is auto-updated.

Last update: 2024-10-29 04:59:15 UTC


README

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

Installation with Composer

$ composer require germania-kg/users-retailers

MySQL users may install the table users_retailers using users_retailers.sql.txt in sql/ directory.

Find a retailer number

<?php
use Germania\UsersRetailers\RetailerNumberFinder;

// These are pptional
$table  = 'users_retailers';
$logger = new Monolog;

$finder = new RetailerNumberFinder( $pdo);
$finder = new RetailerNumberFinder( $pdo, $logger, $table);

$user_id = 1;
$retailer_number = $finder( $user_id );

Development

$ git clone https://github.com/GermaniaKG/UsersRetailers.git
$ cd UsersRetailers
$ composer install

Develop using develop branch, using Git Flow.

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

MySQL Setup

Setup a MySQL table users\_retailers as in sql/users_retailers.sql.txt . In phpunit.xml, edit the database credentials:

<php>
	<var name="DB_DSN"    value="mysql:host=127.0.0.1;dbname=DBNAME;charset=utf8" />
	<var name="DB_USER"   value="DBUSER" />
	<var name="DB_PASSWD" value="DBPASS" />
	<var name="DB_DBNAME" value="DBNAME" />
	<var name="DB_SETUP"  value="sql/users_retailers.sql.txt" />
</php>