Download the PHP package pinkcrab/perique-framework-core without Composer
On this page you can find all versions of the php package pinkcrab/perique-framework-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pinkcrab/perique-framework-core
More information about pinkcrab/perique-framework-core
Files in pinkcrab/perique-framework-core
Package perique-framework-core
Short Description The core package of the PinkCrab Perique framework.
License MIT
Homepage https://pinkcrab.co.uk
Informations about the package perique-framework-core
PinkCrab Perique Plugin Framework
Welcome to the core package of the PinkCrab Perique plugin framework, formally known as just the PinkCrab Plugin Framework.
For more details please visit our docs. https://perique.info
Why?
WordPress is a powerful tool for building a wide range of websites, but due to its age and commitment to backwards compatibility it's often frustration to work with using more modern tools.
Perique allows the creation of plugins, MU libraries for use on more complex websites.
The Core only provides access to the Hook_Loader
, Registration
, DI (DICE IOC Container), App_Config
and basic (native) PHP_Engine
rendering views.
What is Perique?
Perique is rare form of pipe tobacco produced in the St James Parish of Louisiana. This historic tobacco has been produced in the region for centuries and sees tobaccos taken, packed into a barrels under pressure and left to ferment for over 12 months. The resulting tobacco has a strong and pungent quality, which is used to heavily enhance a tobaccos flavour, nicotine content and aroma with only a small quantity used. This is something we strived to produce in this framework; a small amount of existing code that can be used to enhance any codebase to be big, bold and striking.
Setup
First you will need to create your composer.json and plugin.php file.
plugin.php
Previously (pre 1.4.0)
with_wp_dice()
was used to create the App, this is now deprecated, but will remain for a while to account for any legacy code. The main different betweenwith_wp_dice()
anddefault_setup()
is originally a bug existed where view paths by default where the same as the base path, now this is fixed and the default view path is set to the base path +/views
. (Applies to all versions 1.4 and above)
Custom View Path
If you wish to use a custom view path, you can can call $app_factory->set_base_view_path('path/to/views')
before calling default_setup()
.
You can also define a DI rule which will allow you to set the base path directly to the PHP_Engine
class.
Please note by doing this, it will the use
APP_Config::path('views')
orAPP_Config::url('views')
will not match the path you have set.
Config files
While you can pass arrays to the container_config(), app_config() and registration_classes(), these can get quite large. It can help return them from files.
These files can be placed anywhere, but in the above example and our boilerplate's, these 3 files are placed in the /config directory.
dependencies.php
Used to define all of your custom rules for Dice, for more details on how to work with Interfaces and other classes which cant be autowired, see the Perique Docs::Setup
Using the full class name is essential, so ensure you include all needed use statements.
registration.php
When the app is booted, all classes which have either hook calls or needed to be called, are passed in this array.
By default the Hookable middleware is passed, so all classes which implement the Hookable interface will be called. Adding custom Registration Middleware will allow you to pass them in this array for initialisation at boot.
Using the full class name is essential, so ensure you include all needed use statements.
See the Perique Docs::Registration for more details.
settings.php
The App holds an internal config class, this can be used as an injectable collection of helper methods in place of defining lots of constants.
Alongside the usual path and url values that are needed frequently. You can also set namespaces (rest, cache), post types (meta and slug), taxonomies (slug & term meta), database table names and custom values. `
The full set of options can be found in the Perique Docs::App_Config.
Modules and the Registration Service
At the heart of the application is the registration process. Classes can be stacked up and executed at initialisation. This allows for registering into core WP APIs, triggering remote API calls and anything else which needs to be set up when all of WP core is loaded.
Modules
It is possible to extend Perique with the use of Modules
. Modules are a way to add additional functionality to Perique and often come bundled with their own Registration Middleware.
Modules are easily added to the App_Factory by calling $factory->module(Some_Module::class)
and often come with there own config and abstract classes to help with the registration process.
Please see the Perique Docs::Modules for more details about how to create your own modules and also a curated list of existing modules.
Hookable
The
Loader::class
loader has been deprecated and replaced with the newHook_Loader::class
Included with Perique is a single piece of Registration_Middleware. The Hookable
interface and Hookable_Middleware
pair make it easy to register any hooks, shortcodes, post types, taxonomies, admin pages, and rest endpoints. Any class which needs to be processed, implements the Hookable
interface and creates the public function set_hook_loader(Hook_Loader $loader):void{}public function set_di_container(DI_Container $container):void{}``` methods are defined in the Middleware class.
- 1.0.2 - Ensure that middleware class names are only constructed during finalise when all internal DI rules are defined (esc DI Container instance.)
- 1.0.1 - Allow all middleware to be passed as classname and then constructed via the container, as well as allowing fully instantiated classes to be passed.
- 1.0.0 - Renamed Registerable interface to Hookable, including the internal Registerable_Middleware to Hookable_Middleware. Corrected typos, App::registration_classes() now App::registration_classes(), App_Initialization_Exception::registration_exists() to App_Initialization_Exception::registration_exists().
- 0.5.6 - Ensure App_Config is not populated as its DI ruleset as part of App->boot(). This ensures Config Facade is populated with the pass App_Config config array.
- 0.5.5 - Allows passing of registration middleware via App_Factory setup chain. Also allows the passing of DI_Container as a dependency via DI_Container. Allowing for modules to access DI without having to pass App and then use App::make().
- 0.5.4 - Moved to new repo to allow renaming via Packagist
- 0.5.3 - Move to new composer name due to issue with existing.
- 0.5.2 - Updated the primary namespace from PinkCrab\Perique to PinkCrab\Perique. Corrected typo on package name in composer.json, from perqiue to perique.
- 0.5.1 - Removed last Loader::class type hints and references. All now working with Hook_Loader::class
- 0.5.0
- Moved to the new Hook_Loader type.
- Updates to App_Config (creation of meta sub section and move to simple key/value pairs for post type and taxonomies).
- Added setup() and tear_down() methods to the Registration_Middleware interface.
- Moved Collection into its own repository.
- Removed unused service container interface.
- 0.4.1 - Updated tests to reflect the new Hook_Loader's internal structure (accessing protected state for tests)
- 0.4.0 - Introduced new app, with app factory to help with cleaner initialisation. Reintroduced Registration_Middleware which was removed in 0.2.0. Moved the registerables into a default piece of middleware which is automatically added at boot. Added a series of actions around the init callback which runs the registration process.
- 0.3.9 - Moved Loader into its own library, all tests and use statements updated.
- 0.3.8 - Added in missing Hook_Removal & Loader tests.
- 0.3.7 - Added in Hook_Removal and made minor changes to the Loader tests.
- 0.3.6 - Added remove_action() and remove_filter() to Loader
- 0.3.5 - Added coverage reports to gitignore
- 0.3.4 - Improved tests and hooked to codecov
- 0.3.3 - Removed object type hint from service container.
- 0.3.2 - Added in tests and expanded view
- 0.3.1 - Minor docblock changes for phpstan lv8
All versions of perique-framework-core with dependencies
gin0115/dice Version 4.1.*
psr/container Version ^1.0
pinkcrab/hook-loader Version ^1.1
pinkcrab/function-constructors Version 0.2.*