Download the PHP package jtreminio/zimple without Composer

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

Zimple

This is a wrapper around the simple Pimple container. It provides a few features that makes handling objects and writing tests much easier.

If you have a codebase that is untestable and you are unable to offer deep refactoring to make it untestable, having a container such as this one is a good step toward gaining control over your codebase.

Installation

Add it to your composer.json file:

"jtreminio/zimple": "1.0.*@dev"

Then run ./composer.phar update. This will also install the Pimple container

Now just put it in your code:

Zimple::setPimple(new Pimple);

Usage

Zimple accepts a fully qualified name:

$date = Zimple::get('\DateTime');

You can also pass in an optional array of parameters for the object constructor:

$date = Zimple::get('\DateTime', array('now', Zimple::get('\DateTimeZone')));

By default Zimple returns a new instance of an object everytime you call Zimple::get(). You can override this behavior by calling Zimple::set() and setting the third parameter to true:

$today = Zimple::get('\DateTime');
$tomorrow = Zimple::get('\DateTime', array('tomorrow'));

// $today !== $tomorrow

Zimple::set('\DateTime', $tomorrow, true);

$tomorrowDup = Zimple::get('\DateTime');

// $tomorrowDup == $tomorrow

$twoDaysAgo = Zimple::get('\DateTime', array('2 days ago'));

// $twoDaysAgo == $tomorrow

You can define objects as you normally would for Pimple before or after passing to Zimple:

// From Pimple's homepage
$pimple = new Pimple;

// define some objects
$pimple['session_storage'] = function ($c) {
    return new $c['session_storage_class']($c['cookie_name']);
};

$pimple['session'] = function ($c) {
    return new Session($c['session_storage']);
};

Zimple::setPimple($pimple);

Then access them as normal: $session = Zimple::get('session_storage');

Zimple is a Weird Name

Zimple wraps around Pimple, which is a gross name. SandyZoop recommended I name it Cyst or Zit, which is equally gross. The goal of this container is to make dependency management simple and easy to use, and make previously untestable code testable.

Pimple + Simple = Zimple.

You can always alias it with

use jtreminio\Zimple\Zimple as Container;
Container::setPimple(new Pimple);
$date = Container::get('\DateTime');

Testing

Zimple makes the process of inserting mocks from your tests extremely easy. It makes use of ::set() to prevent the code from overwriting the PHPUnit mock. Check out the tests for several easy examples.


All versions of zimple with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
pimple/pimple Version 1.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 jtreminio/zimple contains the following files

Loading the files please wait ....