Skip to content

Commit

Permalink
Readme updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Torann committed Feb 12, 2015
1 parent 6a47c4c commit 48d8b76
Showing 1 changed file with 27 additions and 61 deletions.
88 changes: 27 additions & 61 deletions README.md
Expand Up @@ -11,85 +11,51 @@ Registry manager for Laravel. An alternative for managing application configurat
- [Registry on Packagist](https://packagist.org/packages/torann/registry)
- [Registry on GitHub](https://github.com/Torann/laravel-registry)

Add the following into your `composer.json` file:

```json
{
"require": {
"torann/registry": "0.1.*@dev"
}
}
```

Add the service provider and alias into your `app/config/app.php`

```php
'providers' => array(
'Torann\Registry\RegistryServiceProvider',
),

'Registry' => 'Torann\Registry\Facades\Registry',
```

Create configuration file using artisan

```
php artisan config:publish torann/registry
```

Run `php artisan migrate --package="torann/registry"` to install the registry table
To get the latest version of Registry simply require it in your `composer.json` file.

## Usage
~~~
"torann/registry": "0.1.*@dev"
~~~

**Retrieve an item from the registry**
You'll then need to run `composer install` to download it and have the autoloader updated.

```php
Registry::get('foo'); \\will return null if key does not exists
Registry::get('foo.bar'); \\will return null if key does not exists

Registry::get('foo', 'undefined') \\will return undefined if key does not exists
```

**Store item into registry**
Once Registry is installed you need to register the service provider with the application. Open up `app/config/app.php` and find the `providers` key.

```php
Registry::set('foo', 'bar');
Registry::set('foo', array('bar' => 'foobar'));

Registry::get('foo'); \\bar
Registry::get('foo.bar'); \\foobar
'providers' => array(
'Torann\Registry\RegistryServiceProvider',
)
```

**Remove item from registry**
Registry also ships with a facade which provides the static syntax for creating collections. You can register the facade in the aliases key of your `app/config/app.php` file.

```php
Registry::forget('foo');
Registry::forget('foo.bar');
'aliases' => array(
'Registry' => 'Torann\Registry\Facades\Registry',
)
```

**Flush registry**
### Publish the config

```php
Registry::flush();
```
Run this on the command line from the root of your project:

**Mass update**
~~~
$ php artisan config:publish torann/registry
~~~

```php
$settings = array(
'site_name' => 'FooBar, Inc.',
'address' => '11 Bean Street',
'email' => 'foo@bar.com'
);
This will publish Moderate's config to ``app/config/packages/torann/moderate/``.

Registry::store($settings);
```
### Migration

## Custom Timestamp Managers
Run this on the command line from the root of your project:

~~~
$ php artisan migrate --package="torann/registry"
~~~

For instance when multiple web servers are sharing a database we need to ensure the settings are all in sync. To accomplish this we use timestamp managers. The master timestamp is held in **Redis** and compared against the cached registry's timestamp, if the cached version is expired the system reloads the registry from the database and caches them.
## Documentation

To write a custom timestamp manager implement `Torann\Registry\Timestamps\TimestampInterface` and include your class in the registry settings `timestamp_manager`.
[View the official documentation](http://lyften.com/projects/laravel-registry/).

## Change Log

Expand Down

0 comments on commit 48d8b76

Please sign in to comment.