PHPackages                             ygoncharova/terminal - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. ygoncharova/terminal

ActiveLibrary[CLI &amp; Console](/categories/cli)

ygoncharova/terminal
====================

00PHPCI failing

Since Jun 16Pushed 6y ago1 watchersCompare

[ Source](https://github.com/yhoncharova/TerminalLib)[ Packagist](https://packagist.org/packages/ygoncharova/terminal)[ RSS](/packages/ygoncharova-terminal/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Terminal Library
================

[](#terminal-library)

**Set prices for products, scan products and get calculated total price**

\##Requirements The Terminal library has the following requirements:

PHP 7.3+ PHPUnit ^6.5

Installation
------------

[](#installation)

```
$ git clone git@github.com:yhoncharova/TerminalLib.git
$ composer update
```

[composer](https://packagist.org/packages/yhoncharova/terminal)

Terminal
--------

[](#terminal)

Create an instance:

```
$terminal = new Terminal();
```

Set prices for products:

```
$code = 'AZ';
$quantity = 1;
$price = 2.00;
$terminal->setPricing($code, $quantity, $price);
```

Scan products:

```
$terminal->scanCode('AZ');
```

Get calculated total price for scanned products:

```
$terminal->getTotal();
```

Price
-----

[](#price)

Price for unit volume of products. To create Price object, pass quantity as integer and price as float.

```
$price = new Price(2, 17.25);
```

\##Product Each item of the basket is encapsulated as an instance of `Product`.

The `Product` class contains the current state of the each item in the basket.

To create a new `Product`, pass the product's `code`, `quantity`. Quantity will be set automatically to 1, if no value passed into constructor.

```
$code  = '1';
$quantity = 2;
$product = new Product($code, $quantity);
```

To increase `quantity`, use `increaseQuantity` method.

```
$product->increaseQuantity();  // increment `quantity`
$product->increaseQuantity(3); // increase `quantity` by 2 items
```

The `code` should not be changed once the `Product` is created and so there is no setter method for the property on the object.

\##Pricier Collection of Product codes which are linked to collection of their Price objects. To fill Pricier with product prices:

```
$pricier = new Pricier();
$pricier->add($code, $quantity, $price);
$pricier->add($code, $quantity, $price);
```

To get price of particular product:

```
$pricier->getPrice($product);
```

\##Basket The Basket object manages the adding of products into basket.

To create a new `Basket` instance:

```
$basket = new Basket();
```

The `Basket` will create a new `Collection` instance in constructor to encapsulate manage the Product instances in basket.

Get the count of the products:

```
$basket->count();
```

Get a product from the basket via it's `code`:

```
$product = $basket->get('AZ');
```

To add a product to the basket, pass the `code` to `add` method. If product with the `code` already exists in the basket, then `quantity` will be incremented.

```
$code  = 'AZ';
$basket->add($code);
```

Thanks for using :)

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3215693?v=4)[Yuliia Honcharova](/maintainers/ygoncharova)[@ygoncharova](https://github.com/ygoncharova)

### Embed Badge

![Health badge](/badges/ygoncharova-terminal/health.svg)

```
[![Health](https://phpackages.com/badges/ygoncharova-terminal/health.svg)](https://phpackages.com/packages/ygoncharova-terminal)
```

###  Alternatives

[illuminate/console

The Illuminate Console package.

13046.0M6.4k](/packages/illuminate-console)[styleci/cli

The CLI tool for StyleCI

71470.5k9](/packages/styleci-cli)[winbox/args

Windows command-line formatter

20720.9k21](/packages/winbox-args)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
