Download the PHP package pugx/godfather without Composer

On this page you can find all versions of the php package pugx/godfather. 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 godfather

Godfather

godfather A library for the strategy pattern in PHP, if you use Symfony2 you could easily integrate Godfather with the bundle.
  1. The Strategy pattern
  2. Installation
  3. Symfony2 bundle
  4. Contribution

travis-ci Latest Stable Version Total Downloads Latest Unstable Version


The Strategy Pattern

http://en.wikipedia.org/wiki/Strategy_pattern

Intent

Define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets the algorithm vary independently from clients that use it.

TL;DR

Given an object, you want to know its service.

eg. Entity\Mug has a MugService and Entity\Tshirt has a TshirtService

Sandbox

A working example is at example/godfather.php

When do you need a strategist as Godfather?

Installation

composer require pugx/godfather ~0.1

A simple use case

The problem is that you have an object and you want to handle it properly.

How it works

This library does not try to duplicate the services, or to create a new container, but uses aliases in order to have a mapping between services and names.

An object is converted by the Context::getStrategyName more info at changing the Context::Converter.

The smelling code

If your code look like this you will need the godfather's protection :)

The strategist

GodFather and an array as DIC

GodFather and Symfony Dependency Injection Container

Using the Symfony2 Bundle

Install the Bundle

Add the bundle in the app/AppKernel.php

Configuring app/config/config.yml

Minimal Configuration

With the fallback strategy

Set your strategies:

Using in the controller:

Advanced with multiple instances

Instead of default you could configure your strategy in different godfather instances.

the strategies:

and then the code with multiple instances

Changing the Context::Converter

The Godfather\Context\Context::getStrategyName transforms an object into a strategy name, the default one just extract from the $object the short class name.

If you want another converter create your class extends the ContextInterface and then:

Contribution

Active contribution and patches are very welcome. To keep things in shape we have quite a bunch of unit tests. If you're submitting pull requests please make sure that they are still passing and if you add functionality please take a look at the coverage as well it should be pretty high :)

License

The license is visible here.


All versions of godfather with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
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 pugx/godfather contains the following files

Loading the files please wait ....