mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 01:31:45 +01:00
Readme > update paragraphs with Composer, Docker & use 1st level headers
This commit is contained in:
41
README.md
41
README.md
@@ -3,7 +3,7 @@ Common and useful classes, methods, exceptions etc.
|
|||||||
|
|
||||||
[](https://travis-ci.org/meritoo/common-library) [](https://packagist.org/packages/meritoo/common-library) [](https://styleci.io/repos/101790028) [](https://github.com/meritoo/common-library) [](https://github.com/meritoo/common-library) [](https://coveralls.io/github/meritoo/common-library?branch=master)
|
[](https://travis-ci.org/meritoo/common-library) [](https://packagist.org/packages/meritoo/common-library) [](https://styleci.io/repos/101790028) [](https://github.com/meritoo/common-library) [](https://github.com/meritoo/common-library) [](https://coveralls.io/github/meritoo/common-library?branch=master)
|
||||||
|
|
||||||
## Installation
|
# Installation
|
||||||
|
|
||||||
Run [Composer](https://getcomposer.org) to install this package in your project:
|
Run [Composer](https://getcomposer.org) to install this package in your project:
|
||||||
|
|
||||||
@@ -11,18 +11,41 @@ Run [Composer](https://getcomposer.org) to install this package in your project:
|
|||||||
$ composer require meritoo/common-library
|
$ composer require meritoo/common-library
|
||||||
```
|
```
|
||||||
|
|
||||||
> How to install Composer: https://getcomposer.org/download
|
> [How to install Composer?](https://getcomposer.org/download)
|
||||||
|
|
||||||
## Rebuilding project and tests running
|
# Docker
|
||||||
|
|
||||||
|
Build, create and start Docker's containers by running command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ docker-compose up -d
|
$ docker-compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
> [What is Docker?](https://www.docker.com/what-docker)
|
||||||
|
|
||||||
|
# Composer
|
||||||
|
|
||||||
|
Install packages by running command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker-compose run composer install
|
||||||
|
```
|
||||||
|
|
||||||
|
Update packages by running command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ docker-compose run composer update
|
||||||
|
```
|
||||||
|
|
||||||
|
# Rebuild project and run tests
|
||||||
|
|
||||||
|
```bash
|
||||||
$ docker-compose exec php-cli phing
|
$ docker-compose exec php-cli phing
|
||||||
```
|
```
|
||||||
|
|
||||||
> What is Docker? https://www.docker.com/what-docker
|
> [What is Docker?](https://www.docker.com/what-docker)
|
||||||
|
|
||||||
## Static methods
|
# Static methods
|
||||||
|
|
||||||
This package contains a lot of class with static methods, so usage is not so complicated. Just run the static method who would you like to use. Example:
|
This package contains a lot of class with static methods, so usage is not so complicated. Just run the static method who would you like to use. Example:
|
||||||
|
|
||||||
@@ -33,7 +56,7 @@ $firstElement = Arrays::getFirstElement(['lorem', 'ipsum']);
|
|||||||
var_dump($firstElement); // string(5) "lorem"
|
var_dump($firstElement); // string(5) "lorem"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Base test case with common methods and data providers
|
# Base test case with common methods and data providers
|
||||||
|
|
||||||
Located here: `Meritoo\Common\Test\Base\BaseTestCase`. Just extend the `BaseTestCase` class and use it like in `Meritoo\Common\Test\Utilities\DateTest` class:
|
Located here: `Meritoo\Common\Test\Base\BaseTestCase`. Just extend the `BaseTestCase` class and use it like in `Meritoo\Common\Test\Utilities\DateTest` class:
|
||||||
|
|
||||||
@@ -73,7 +96,7 @@ class MimeTypesTest extends BaseTestCase
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Collection of elements
|
# Collection of elements
|
||||||
|
|
||||||
Located here: `Meritoo\Common\Collection\Collection`. It's a set of some elements, e.g. objects. It's iterable and countable. Provides very useful methods. Some of them:
|
Located here: `Meritoo\Common\Collection\Collection`. It's a set of some elements, e.g. objects. It's iterable and countable. Provides very useful methods. Some of them:
|
||||||
- `getFirst()` - returns the first element in the collection
|
- `getFirst()` - returns the first element in the collection
|
||||||
@@ -86,7 +109,7 @@ Located here: `Meritoo\Common\Collection\Collection`. It's a set of some element
|
|||||||
|
|
||||||
Examples of usage below.
|
Examples of usage below.
|
||||||
|
|
||||||
#### An empty collection
|
### An empty collection
|
||||||
|
|
||||||
```php
|
```php
|
||||||
use Meritoo\Common\Collection\Collection;
|
use Meritoo\Common\Collection\Collection;
|
||||||
@@ -95,7 +118,7 @@ $emptyCollection = new Collection();
|
|||||||
var_dump($emptyCollection->isEmpty()); // bool(true)
|
var_dump($emptyCollection->isEmpty()); // bool(true)
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Simple collection
|
### Simple collection
|
||||||
|
|
||||||
```php
|
```php
|
||||||
use Meritoo\Common\Collection\Collection;
|
use Meritoo\Common\Collection\Collection;
|
||||||
|
|||||||
Reference in New Issue
Block a user