PHP code example of shov / laravel-registry

1. Go to this page and download the library: Download shov/laravel-registry library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shov / laravel-registry example snippets


    providers' => [
        ...
        
        /*
         * Package Service Providers...
         */
        Shov\Registry\RegistryServiceProvider::class,
        
        ...
    ]
    

$this->registry
    ->set('foo', 'x')
    ->values(['bar' => 'y']);
    
$xy = $this->registry->get('foo') 
      . $this->registry->get('bar');
      
assert('xy' === $xy);

$empty = $this->registry
            ->set('some', 'value')
            ->set('foo', 'bar')
            ->immutable('answer', 42)
            ->flush(true)
            ->all();
            
assert(empty($empty));
text
,---------------------------------------------.
|RegistryInterface                            |
|---------------------------------------------|
|---------------------------------------------|
|+has(string $key): bool                      |
|                                             |
|+get(string $key, $default = null): mixed    |
|+all(array $defaults = []): array            |
|                                             |
|+set(string $key, $value): static            |
|+values(array $pairs): static                |
|                                             |
|+immutable(string $key, $value): static      |
|                                             |
|+forget(string $key): static                 |
|+flush(bool force): static                   |
|                                             |
|+getImmutableKeys(): array                   |
|                                             |                                             |
|+stopPersist(): static                       |
`---------------------------------------------'