PHPackages                             jaroslavtyc/flowmedia-dir-sync - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. jaroslavtyc/flowmedia-dir-sync

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

jaroslavtyc/flowmedia-dir-sync
==============================

Just a proof of my skills to get a job

1.0.0(5y ago)05MITHTMLPHP &gt;= 7.1

Since Sep 30Pushed 5y ago1 watchersCompare

[ Source](https://github.com/jaroslavtyc/flowmedia-dir-sync)[ Packagist](https://packagist.org/packages/jaroslavtyc/flowmedia-dir-sync)[ RSS](/packages/jaroslavtyc-flowmedia-dir-sync/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

Proof of my skills to get a job
===============================

[](#proof-of-my-skills-to-get-a-job)

**NOT a production-ready code!**

Use at your own risk.

*But I will be happy if you will get inspired by this 😉*

Purpose
-------

[](#purpose)

I should be able to create a [standalone](#standalone), [independent](#independent) library to control directories by a JSON configuration and CLI. With use of object-oriented programming and PHP (in a version of my choice).

### Standalone

[](#standalone)

This library should be runnable just by a terminal emulator and a PHP executable.

*for example:*

```
php ./bin/dirsync --dry-run
```

### Independent

[](#independent)

No other libraries should be used (not even shinnies as the [Symfony Console](https://symfony.com/doc/current/components/console.html#installation)).

### Usage

[](#usage)

Create a JSON file with configuration directives:

- key starting with a hash sign `#` is processed as an **Action**, value (scalar, array, object...) is then used as a parameter to `Action->runAction` itself
    - see `\JaroslavTyc\DirSync\Actions\ActionInterface` for details
- key **not** starting by a hash sign `#` is considered as a dir name and is used for **Create Dir Action** directly as a value
    - any value pointed by that JSON key will be ignored (hint: use `null` there)
    - see `\JaroslavTyc\DirSync\Actions\CreateDirAction` for details

*for example:*

```
{
    "NewDirByDirSyncDirectName": null,
    "#CreateDir": "NewDirByDirSyncCreateDirAction"
}
```

Process it:

```
php ./bin/dirsync --json-config=json_config_file_for_dir_sync.json
```

Should create two empty directories `NewDirByDirSyncDirectName` and `NewDirByDirSyncCreateDirAction` in a current working directory.

### More Actions

[](#more-actions)

Create your own **Action** implementing `\JaroslavTyc\DirSync\Actions\ActionInterface` and register them to `\JaroslavTyc\DirSync\ActionsRunner`.

*for example:*

```
