2017 © Pedro Peláez
 

cakephp-plugin cakephp-libregistry

The LibRegistry provides a mechanism for loading and storing instances of non-Cake PHP libraries. It works a lot like Cake 3's TableRegistry. Object instances can be requested by name and instantiated automatically, or can be loaded into the registry manually.

image

loadsys/cakephp-libregistry

The LibRegistry provides a mechanism for loading and storing instances of non-Cake PHP libraries. It works a lot like Cake 3's TableRegistry. Object instances can be requested by name and instantiated automatically, or can be loaded into the registry manually.

  • Thursday, September 29, 2016
  • by jtyost2
  • Repository
  • 9 Watchers
  • 2 Stars
  • 8,722 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 7 % Grown

The README.md

CakePHP LibRegistry Plugin

Packagist Version Software License Build Status Coverage Status Total Downloads, (*1)

The LibRegistry provides a mechanism for loading and storing instances of non-Cake PHP libraries. It works a lot like Cake 3's TableRegistry. Object instances can be requested by name and instantiated automatically, or can be loaded into the registry manually., (*2)

Requirements

  • CakePHP 3.0+

Installation

Composer

$ composer require loadsys/cakephp-libregistry:~1.0

Usage

  • Invoke the LibRegistry statically:, (*3)

    <?php
    
    namespace App\Whatever;
    
    use LibRegistry\LibRegistry;
    
    class MyController extends Controller {
        public function index() {
            $myObj = LibRegistry::get('MyObj', ['configs' => 'here']);
            // (Where the class `src/Lib/MyObj.php` exists.)
            $myObj->doSomethingNeat();
        }
    }
    
    
  • A trait is also provided to load libraries into existing classes:, (*4)

    <?php
    
    namespace App\Whatever;
    
    use LibRegistry\LibRegistryTrait;
    
    class MyController extends Controller {
        use LibRegistryTrait;
        public function index() {
            $this->loadLib('MyObj', ['configs' => 'here']);
            $this->MyObj->doSomethingNeat();
            // Works like loadComponent() in this context.
        }
    }
    
    

Library classes

  • Must exist in src/Lib/ in your Cake app or plugin and must be namespaced appropriately., (*5)

  • Must accept a single array of config values as the sole __construct() argument. Libraries that don't conform to this interface can't be instantiated via LibRegistry::get(), although they can still be stored in the Registry manually via ::set()., (*6)

Contributing

Code of Conduct

This project has adopted the Contributor Covenant as its code of conduct. All contributors are expected to adhere to this code. Translations are available., (*7)

Reporting Issues

Please use GitHub Isuses for listing any known defects or issues., (*8)

Development

Please fork and issue a PR targeting the master branch for any new development., (*9)

The full test suite for the plugin can be run via this command:, (*10)

$ vendor/bin/phpunit

Code must conform to the Loadsys coding standard, which is based on the CakePHP coding standard:, (*11)

$ vendor/bin/phpcs --config-set installed_paths vendor/cakephp/cakephp-codesniffer,vendor/loadsys/loadsys_codesniffer
$ vendor/bin/phpcs -p --standard=Loadsys src

License

MIT, (*12)

Loadsys Web Strategies 2016, (*13)

The Versions

29/09 2016

dev-master

9999999-dev https://github.com/loadsys/CakePHP-LibRegistry

The LibRegistry provides a mechanism for loading and storing instances of non-Cake PHP libraries. It works a lot like Cake 3's TableRegistry. Object instances can be requested by name and instantiated automatically, or can be loaded into the registry manually.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Brian Porter

plugin cakephp registry libraries singleton

29/09 2016

1.0.2

1.0.2.0 https://github.com/loadsys/CakePHP-LibRegistry

The LibRegistry provides a mechanism for loading and storing instances of non-Cake PHP libraries. It works a lot like Cake 3's TableRegistry. Object instances can be requested by name and instantiated automatically, or can be loaded into the registry manually.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Brian Porter

plugin cakephp registry libraries singleton

18/05 2016

1.0.1

1.0.1.0 https://github.com/loadsys/CakePHP-LibRegistry

The LibRegistry provides a mechanism for loading and storing instances of non-Cake PHP libraries. It works a lot like Cake 3's TableRegistry. Object instances can be requested by name and instantiated automatically, or can be loaded into the registry manually.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Brian Porter

plugin cakephp registry libraries singleton

05/08 2015

1.0.0

1.0.0.0 https://github.com/loadsys/CakePHP-LibRegistry

The LibRegistry provides a mechanism for loading and storing instances of non-Cake PHP libraries. It works a lot like Cake 3's TableRegistry. Object instances can be requested by name and instantiated automatically, or can be loaded into the registry manually.

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

by Brian Porter

plugin cakephp registry libraries singleton