PHPackages                             upmind/provision-provider-base - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. upmind/provision-provider-base

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

upmind/provision-provider-base
==============================

This library contains all the base interfaces, classes and logic to create provision category and provider classes, and register them for use in a laravel application.

v4.3.4(4mo ago)310.6k↓36.7%[12 issues](https://github.com/upmind/provision-provider-base/issues)10GPL-3.0-onlyPHPPHP &gt;=8.0 &lt;8.4CI passing

Since Apr 29Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/upmind/provision-provider-base)[ Packagist](https://packagist.org/packages/upmind/provision-provider-base)[ RSS](/packages/upmind-provision-provider-base/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (9)Versions (46)Used By (10)

Upmind Provision Provider Base
==============================

[](#upmind-provision-provider-base)

[![Latest Version on Packagist](https://camo.githubusercontent.com/5250d65460232e9fcda647e80395ced8314c511e2522a8fcb82b815996ea9186/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f75706d696e642f70726f766973696f6e2d70726f76696465722d626173652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/upmind/provision-provider-base)

**To see an example of this library in action, check out [upmind/provision-workbench](https://github.com/upmind-automation/provision-workbench#readme)**

This library contains all the base interfaces, classes and logic to create provision category and provider classes, and register them for use in a laravel application.

Normally this library will not be used standalone, as it will be installed as a sub-dependency of a provision category/provider library such as [upmind/provision-provider-shared-hosting](https://github.com/upmind-automation/provision-provider-shared-hosting#readme).

- [Installation](#installation)
    - [Docker](#docker)
- [Usage](#usage)
    - [Categories](#create-a-category)
        - [Example Category](#example-category)
    - [Providers](#create-a-provider)
        - [Example Provider](#example-provider)
    - [Provision Registry](#registering-categories-and-providers)
        - [Example Service Provider](#example-service-provider)
        - [Using the Provision Registry](#using-the-provision-registry)
        - [Caching the Provision Registry](#caching-the-provision-registry)
    - [Executing Functions](#executing-provision-functions)
- [Data Sets](#data-sets)
    - [Example Parameter Data Set](#example-parameter-data-set)
    - [Example Return Data Set](#example-return-data-set)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)
- [Upmind](#upmind)

Installation
------------

[](#installation)

```
composer require upmind/provision-provider-base
```

### Docker

[](#docker)

The package provides samples of Dockerfile files to support local development and testing.

To use them, you need to have Docker and Docker Compose installed on your machine.

A `Makefile` is provided to simplify the usage of the docker-compose files.

- `make setup-php82` sets up the PHP 8.2 development environment.
- `make static-analysis` runs the static analysis.

Usage
-----

[](#usage)

The sections below describe how to create Provision Categories and Provider classes. Very simply, a provision [Category](#create-a-category) is an abstract class which declares provision functions as abstract public methods. [Provider](#create-a-provider)classes extend their parent Category class, and must therefore implement each abstract provision function declared for the Category.

This library makes use of self-validating DataSets, which are explained [below](#data-sets).

### Create a Category

[](#create-a-category)

Provision categories are abstract classes which MUST implement [CategoryInterface](./src/Provider/Contract/CategoryInterface.php). For convenience, a [BaseCategory](./src/Provider/BaseCategory.php) exists which can be extended so that all Providers will have access to some common methods which aid in producing provision function results.

Category classes act as the provision 'contract' and are responsible for 2 key things:

1. Defining [AboutData](./src/Provider/DataSet/AboutData.php) which contains the human-readable name and description and other metadata about the category, by implementing [CategoryInterface::aboutCategory()](./src/Provider/Contract/CategoryInterface.php).
2. Defining abstract public methods which make up the available provision functions of this category. These abstract methods should define their parameters by type-hinting a single [DataSet](#data-sets)class and their return values by return-typing a [ResultData](./src/Provider/DataSet/ResultData.php)class, if parameters or return values are needed for any given function.

##### Example Category

[](#example-category)

```
