Download the PHP package degraciamathieu/manager without Composer

On this page you can find all versions of the php package degraciamathieu/manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package manager

Build Status Code Coverage Latest Version on Packagist

DeGraciaMathieu/Manager

Implementation of the Manager pattern existing in Laravel framework.

Installation

Manager 3.* 2.* 1.*
php ^8.1 :white_check_mark: :x: :x:
php 8.0.* :white_check_mark: :white_check_mark: :x:
php 7.* :x: :x: :white_check_mark:

Usage

This package offers an abstract class DeGraciaMathieu\Manager\Manager which needs to be extended to implement the creation of various Driver classes :

A driver is a class integrating all the logic of an implementation, in our examples the interactions with the APIs of Openweathermap :

From now on, you can directly call the method of a driver directly from the manager :

The manager will call the itsRainingNow method of the default driver configured by the getDefaultDriver method.

You can also call any driver from the manager's driver method :

Now if you want to create a new implementation, for example if you want to use Aerisweather APIs, you just have to create a new driver in your manager :

Tip, the getDefaultDriver method is the perfect place to use a configuration or environment variable !

Add an interface to the drivers

For more consistency it is advisable to implement an interface to the different drivers :

You obviously need to add this interface to your drivers.

Now you will be assured that each driver instantiated by the manager will have the same interface.

Repository class

To control side effects of drivers, it is advisable to create a class encapsulating the instance of a driver, this class is usually called Repository :

The repository is a class providing a bridge between your application and the driver :

This repository class is an anti-corruption layer

Thus, your application will never be aware of which driver it is handling, because it will always be encapsulated in a class repository.

The repository is also a good place if you need to add specific logic for all drivers.

Work with singleton

You can also cache the creation of Drivers with the $singleton property.

With the singleton property you will only create one instance of Openweathermap driver :

by default, singleton property value is False

Example with Laravel

Usage example of the pattern manager in a Laravel project.


All versions of manager with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package degraciamathieu/manager contains the following files

Loading the files please wait ....