Skip to content

Commit

Permalink
Readme: update
Browse files Browse the repository at this point in the history
  • Loading branch information
janpecha committed Sep 4, 2015
1 parent f3841da commit c01c3a9
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CzProject\PathHelper

Helper class for generating relative paths, absolutizing paths, ...
Helper class for creating relative paths, absolutizing paths, ...

## Usage

Expand All @@ -9,9 +9,11 @@ Helper class for generating relative paths, absolutizing paths, ...
$helper = new CzProject\PathHelper;
```

### Absolutize paths
### Absolutize path

``` php
$helper->absolutizePath($path);

$helper->absolutizePath('path/to/my/../text/./file.txt');
```

Expand All @@ -25,20 +27,23 @@ $helper->absolutizePath('path/to/my/../text/./file.txt', '/file/root/'); // retu
```


### Creating relative paths
### Creating relative path

``` php
$source = 'root/dir/docs/1.0/index.html';
$dest = 'root/dir/imgs/image.jpg';

$helper->createRelativePath($source, $dest);
```

Returns ```../../imgs/image.jpg```


### Is given paths current?
### Is given path current?

``` php
$helper->isPathCurrent($path, $mask);

$helper->isPathCurrent('dir/file.txt', 'dir/file-2.txt'); // returns FALSE
$helper->isPathCurrent('dir/file.txt', 'dir/*'); // returns TRUE
$helper->isPathCurrent('dir/sub/file.txt', 'dir/*'); // returns FALSE
Expand All @@ -54,7 +59,7 @@ $helper->isPathCurrent('dir/sub/file.txt', 'dir/**'); // returns TRUE
[Download a latest package](https://github.com/nette/tester/releases) or use [Composer](http://getcomposer.org/):

```
composer require [--dev] czproject/paths-helper
composer require [--dev] czproject/path-helper
```

Library requires PHP 5.3.0 or later.
Expand Down

0 comments on commit c01c3a9

Please sign in to comment.