Download the PHP package gdetassigny/simple-container without Composer

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

Simple Container

Build Status Coverage Status

This is a simple implementation of the standard container interface, with support for autowiring.

This means that this package will attempt to figure out all your basic dependencies for you. It also supports manually defining dependencies in a YAML file, or even adding service providers for more complex dependencies.

Installation

This package requires at least PHP 7.2.

Install it using composer:

How to use it

Basic usage

Setting up a basic container is quite simple:

That's it! You can now request your dependencies from the container, thanks to autowiring.

Autowiring

The container will be able to instantiate simple services which have straightforward dependencies in their constructors:

The below examples can all be autowired:

Some cases cannot be autowired:

YAML Config

Simple container also supports adding a YAML config to manually define dependencies.

This can be useful to define a concrete class implementation of an interface. Or you may want to define a different name for your service than its class name.

Simply pass the path of the YAML file to the container provider:

Service Provider

If a service requires a more complex setup, you may want to look at using a service provider.

Ordering

When called, the container will look for your service using all 3 above options in that order:

Why use this instead of another container package?

To be honest? Maybe you shouldn't. I built this mostly out of interest to understand how containers work under the hood. There are a lot of more evolved PHP containers out there.

However, I tried to make this package as straightforward to use as possible. If having a container up and running very quickly appeals to you then feel free to give this a go!

Furthermore, as it respects the standard container interface, you can always try it for a bit and later switch to another container package without too much hassle.


All versions of simple-container with dependencies

PHP Build Version
Package Version
Requires php Version >= 7.2
psr/container Version ^1.0
symfony/yaml Version ^4.4
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 gdetassigny/simple-container contains the following files

Loading the files please wait ....