Skip to content

Commit

Permalink
ref README
Browse files Browse the repository at this point in the history
  • Loading branch information
vasa-c committed Dec 7, 2015
1 parent 9cc81b3 commit e4a3fab
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# axy\syspaths

Specifying paths within the system.

[![Latest Stable Version](https://img.shields.io/packagist/v/axy/syspaths.svg?style=flat-square)](https://packagist.org/packages/axy/syspaths)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%205.4-8892BF.svg?style=flat-square)](https://php.net/)
[![Build Status](https://img.shields.io/travis/axypro/syspaths/master.svg?style=flat-square)](https://travis-ci.org/axypro/syspaths)
[![Coverage Status](https://coveralls.io/repos/axypro/syspaths/badge.svg?branch=master&service=github)](https://coveralls.io/github/axypro/syspaths?branch=master)
[![License](https://poser.pugx.org/axy/syspaths/license)](LICENSE)

Specifying paths within the system

* GitHub: [axypro/syspaths](https://github.com/axypro/syspaths)
* Composer: [axy/syspaths](https://packagist.org/packages/axy/syspaths)

PHP 5.4+
* The library does not require any dependencies (except composer packages).
* Tested on PHP 5.4+, PHP 7, HHVM (on Linux).
* Install: `composer require axy/syspaths`.
* License: [MIT](LICENSE).

Library does not require any dependencies (except composer packages).

## Purpose
### Documentation

The library allows to store of the directories structure within a certain system.
Inside an application for example.
Expand All @@ -35,7 +35,7 @@ $tplFN = $app->paths->templates.'/default.twig'; // /www/example.loc/templates/d

Define paths in one place makes it easy to change the structure.

## API
#### API

The library provides a single class `axy\syspaths\Paths`.

Expand All @@ -47,7 +47,7 @@ Paths::__construct(string $root [, array $patterns]);

The only required arguments is `$root` - the root directory of the system.

### $patterns
##### $patterns

`$patterns` specifies a list of sub-paths.
It can be specified via the constructor (as in the example above).
Expand All @@ -73,7 +73,7 @@ Or you can define the property `$patterns` and also specify the argument of the
In this case these two list recursively merged.
For example, define a system class and redefine some paths for tests.

### Access to paths
##### Access to paths

Via magic methods.

Expand All @@ -86,7 +86,7 @@ isset($paths->htdocs); // TRUE
$paths->htdocs = 'new-www'; // Exception: Paths is read-only
```

## Patterns
#### Patterns

```php
[
Expand Down Expand Up @@ -114,7 +114,7 @@ $paths->tmp; // /tmp
Other patterns is relative to the root.
`www` is equivalent to `:root:/www`.

## Nested paths
#### Nested paths

```php
[
Expand Down Expand Up @@ -192,7 +192,7 @@ Links can consist of several components:
]
```

## Creating paths
#### Creating paths

```php
$paths->templates->layouts.'/tpl.twig';
Expand All @@ -212,11 +212,10 @@ Paths::create($pattern, $real = false);
If specified the second argument `$real` executed `realpath()` for the result.
If the path is not exists then returned `NULL`.

## Exceptions
#### Exceptions

In the namespace `axy\syspaths\errors`.

* `RequirePatterns` - `$patterns` not defined nor in the property, nor in the constructor.
* `PatternNotFound` - where access via `__get` or in a link form other pattern.
* `InvalidPattern` - not closed link, a nested array is not contains `root`, `__classname` in not exists and etc.

0 comments on commit e4a3fab

Please sign in to comment.