This package provides the application container for sharing services between packages and it helps with testing the integration of PHP packages.
👀🌋 This Is A Module Of The Caldera Framework
-
🌋 Find Caldera Forms Here:
-
🌋 Issues and pull requests, should be submitted to the main Caldera repo.
- Add to your package:
composer require calderawp/http
- Install for development:
git clone [email protected]:CalderaWP/http.git && composer install
-
Provides application container with:
- Interop -
calderawp/interop
: Shared interfaces and traits that:- Interfaces that provide data-typing of entities, more consistent translation to and from array/ JSON/ database serialization and more predictable public APIs of business logic providing classes.
- Traits that provide implementations of these interfaces.
- Forms -
calderawp/forms
: Forms and form entries. - Rest API -
calderawp/rest-api
: REST API endpoints and controllers- REST API endpoints that can translate to and from PSR-7 or WordPress REST API requests.
- The Caldera Forms REST API.
- HTTP -
calderawp/http
: Http interactions between application and outside world via HTTP.- Base Request/Response classes used for REST API request/ responses as well as HTTP clients
- Http clients
- Dispatching HTTP requests to other servers.
- Database -
calderawp/caldera-db
: interactions -- CRUD + anonymize and queries.- Works with WordPress, and could work with any MySQL-like database.
- Mainly for internal use. The data package
- Data Sourcing -
calderawp/data-source
Provides common, swappable interface for accessing application.- By default, uses
calderawp/caldera-db
- Could use any database, locally or via remote API.
- By default, uses
- Events -
calderawp/events
- WordPress-like event dispatching.- Provides an ApplyFilters/AddFilter implementation.
- Needs an AddAction/DoAction implementation.
- The WordPress plugin SHOULD (it does not yet) repeat events with
apply_filters
anddo_action
.
- Interop -
-
Provides tests for said the application container, and runs integration tests.
In general, you should use the function \caldera()
to access the main container or any of the modules.
$calderaForms = caldera()->getCalderaForms();
You can use the static accessor function, which always returns the same, global instance of Caldera Core:
$calderaForms = caldera();
Alternatively, you can create your own instance of Caldera Core:
use calderawp\CalderaContainers\Service\Container;
use calderawp\caldera\core\CalderaCore;
$core = new CalderaCore(new Container());
$calderaForms = caldera()->getCalderaForms();
or
use calderawp\CalderaContainers\Service\Container;
use calderawp\caldera\core\CalderaCore;
$core = new CalderaCore(new Container());
$calderaForms = $core->getCalderaForms();
$calderaForms = caldera()->getRestApi();
or
use calderawp\CalderaContainers\Service\Container;
use calderawp\caldera\core\CalderaCore;
$core = new CalderaCore(new Container());
$restApi = $core->getRestApi();
$calderaForms = caldera()->getEvents();
or
use calderawp\CalderaContainers\Service\Container;
use calderawp\caldera\core\CalderaCore;
$core = new CalderaCore(new Container());
$calderaEvents = $core->getEvents();
$calderaForms = caldera()->getHttp();
or
use calderawp\CalderaContainers\Service\Container;
use calderawp\caldera\core\CalderaCore;
$core = new CalderaCore(new Container());
$calderaEvents = $core->getHttp();
Module must implement calderawp\interop\Contracts\CalderaModule
;
\caldera()->addModule($module);
$module = $core->getModule('moduleIdentifier');
Unit tests are in tests/Unit
. They are run at same time as integration tests -- composer test:integration
-- for now.
Copyright 2018+ CalderaWP LLC and licensed under the terms of the GNU GPL license. Please share with your neighbor.