Download the PHP package andyleap/popple without Composer

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

Popple

Develop

Build Status

Simple DI container for PHP inspired by Pimple.

What does Popple offer over the simplicity of Pimple?

Quite simply, Popple tries to maintain the same level of simplicity, while offering additional functionality to make it easier to work with.

For instance, extending services with Pimple requires several steps and a little bit of work around, as you have to extend the service, and then share it.

With Popple, that's handled for you. Popple takes the viewpoint that everything is shared, so, first, you create the service.

$popple = new Popple();

$popple->Share('db', function($p)
{
  $db = new Popple();
    $db->Extend('Connect', function()
    {
        if(!isset($this['username']))
        {
            die('Username required!');
        }
        echo 'Connecting as ' . $this['username'];
    });
    return $db;
});

This creates a simple service of the main $popple instance. It's accessed and used rather simply

$popple['db']['username'] = 'guest';
$popple['db']->Connect();

This also showcases another feature of Popple, it's ability to quickly extend out and form a service on it's own, without requiring formalized classes, while still allowing easy transitioning to a class structure. Hence, the above is roughly equivalent to

public class DB extends Popple
{
  public function Connect()
  {
    if(!isset($this['username']))
    {
            die('Username required!');
        }
        echo 'Connecting as ' . $this['username'];
  }
}

$popple->Share('db', function($p)
{
  return new DB();
});

Then, all you do is Mutate the service to alter it

$popple->Mutate('db', function($db)
{
  $oldconnect = $db->Connect;
    $db->Extend('Connect', function() use ($oldconnect)
    {
        $oldconnect();
        if(!isset($this['password']))
        {
            die('Password required!');
        }
        echo ' with password ' . $this['password'];
    });
    return $db;
});

Then, all you have to do to use the new Connect method is

$popple['db']['username'] = 'admin';
$popple['db']['password'] = 'password';
$popple['db']->Connect();

Note that the Mutation can occur at any point. The service may have already been instantiated, it may be registered and the mutation queued to occur on instantiation, or the service may not even be registered yet. No matter what, it will work out. This is useful for services that mutually alter each other. Just register the Mutate on the other, and let it all work out. You can even register Mutates for services that never get added without any ill effects.

The final additional feature of Popple is it's ability to be "Popped", hence the naming.

Popping a Popple causes all of it's shared services to be instantiated, and this instantiation walks down the tree, in turn popping any additional Popples or anything that implements Poppable.

This seems rather backwards, as part of the advantage of a system like this is to delay or prevent instantiation as much as possible, but some use cases have slack time when loading could occur, and loading while processing requests later could be minimized by preloading all services


All versions of popple 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 andyleap/popple contains the following files

Loading the files please wait ...