<commit_before># Registry Manager for Laravel

[![Latest Stable Version](https://poser.pugx.org/torann/registry/v/stable.png)](https://packagist.org/packages/torann/registry) [![Total Downloads](https://poser.pugx.org/torann/registry/downloads.png)](https://packagist.org/packages/torann/registry)

Registry manager for Laravel. An alternative for managing application configurations and settings. Now with the magic of caching, so no more database calls to simply get site setting.

----------

## Installation

- [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

## Usage

**Retrieve an item from the registry**

```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**

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

Registry::get('foo'); \\bar
Registry::get('foo.bar'); \\foobar
```

**Remove item from registry**

```php
Registry::forget('foo');
Registry::forget('foo.bar');
```

**Flush registry**

```php
Registry::flush();
```

**Mass update**

```php
$settings = array(
    'site_name' => 'FooBar, Inc.', 
    'address'   => '11 Bean Street', 
    'email'     => '<EMAIL>'
);

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

## Custom Timestamp Managers

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.

To write a custom timestamp manager implement `Torann\Registry\Timestamps\TimestampInterface` and include your class in the registry settings `timestamp_manager`.

## Change Log

#### v0.1.3

- Added timestamp managers for multi-instance websites
- Added custom caching

#### v0.1.2

- Added config for custom table name
- Added forced variable types 
- Code cleanup

#### v0.1.1

- Bug fixes

#### v0.1.0

- First release<commit_msg>Readme updated<commit_after># Registry Manager for Laravel

[![Latest Stable Version](https://poser.pugx.org/torann/registry/v/stable.png)](https://packagist.org/packages/torann/registry) [![Total Downloads](https://poser.pugx.org/torann/registry/downloads.png)](https://packagist.org/packages/torann/registry)

Registry manager for Laravel. An alternative for managing application configurations and settings. Now with the magic of caching, so no more database calls to simply get site setting.

----------

## Installation

- [Registry on Packagist](https://packagist.org/packages/torann/registry)
- [Registry on GitHub](https://github.com/Torann/laravel-registry)

To get the latest version of Registry simply require it in your `composer.json` file.

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

You'll then need to run `composer install` to download it and have the autoloader updated.

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
'providers' => array(
    'Torann\Registry\RegistryServiceProvider',
)
```

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
'aliases' => array(
    'Registry' => 'Torann\Registry\Facades\Registry',
)
```

### Publish the config

Run this on the command line from the root of your project:

~~~
$ php artisan config:publish torann/registry
~~~

This will publish Moderate's config to ``app/config/packages/torann/moderate/``.

### Migration

Run this on the command line from the root of your project:

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

## Documentation

[View the official documentation](http://lyften.com/projects/laravel-registry/).

## Change Log

#### v0.1.3

- Added timestamp managers for multi-instance websites
- Added custom caching

#### v0.1.2

- Added config for custom table name
- Added forced variable types 
- Code cleanup

#### v0.1.1

- Bug fixes

#### v0.1.0

- First release
{'fraction_non_alphanumeric': 0.13754875795524532, 'fraction_numerical': 0.006158899609936358, 'mean_word_length': 4.407325194228635, 'pattern_counts': {'":': 3, '<': 4, '<?xml version=': 0, '>': 13, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5637288', 'n_tokens_mistral': 1486, 'n_tokens_neox': 1416, 'n_words': 488}