Download the PHP package gcworld/container without Composer

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

Container

Packagist Packagist

Packagist PHP Packagist GitHub

gcworld/container implements the PSR-11 container read interface for PHP 8.4 and later, with additional APIs for registering eager services, lazy factories, typed framework services, and independently named container instances.

Version

1.2.0

Installation

Basic usage

The default container is shared for the lifetime of the PHP process:

Calling set() for an existing identifier throws ItemAlreadyExistsException. Use overwrite() when replacement of a general service is intentional. Calling get() for an unknown identifier throws ItemNotFoundException, which implements PSR-11's NotFoundExceptionInterface. Both set() and overwrite() reject null values with an InvalidItemException.

Lazy services

Any callable registered in the container is treated as a zero-argument factory. The factory is invoked on the first get(), and its result replaces the factory in the container:

has() and getItemKeys() inspect the container without resolving factories. If a factory throws, it remains registered and a later call to get() will retry it.

Because callable values are interpreted as factories, callable service objects are not supported as ordinary values. A factory should also return a non-callable value so that the resolved service remains cached.

Composer bootstrap

Applications can populate the container from a Composer autoload file. For example, add a project-owned bootstrap file to the application's composer.json:

The bootstrap can register eager services and lazy factories:

Run composer dump-autoload after adding or moving an autoload file.

Typed framework services

Frequently used framework services have dedicated setters and getters. These methods preserve native return types and provide IDE completion without requiring casts.

Identifier Setter Getter Value type
common setCommon() getCommon() CommonInterface or callable
user setUser() getUser() UserInterface or callable
twig setTwig() getTwig() TwigInterface or callable
globals setGlobals() getGlobals() GlobalsInterface
router setRouter() getRouter() RoutingInterface or callable
page_wrapper setPageWrapper() getPageWrapper() PageWrapper or callable
ui_core setUICore() getUICore() UICoreInterface or callable
object_manager setObjectManager() getObjectManager() ObjectManager or callable
exception_logger setExceptionLogger() getExceptionLogger() ExceptionLoggerInterface or callable

These identifiers are reserved, including case variants, and cannot be registered through set() or overwrite(). The dedicated setters reject duplicate registrations.

Named instances

Use a name when an application needs an isolated container:

Repeated calls with the same name return the same instance. Different names have independent service collections.

Compatibility notes

Development

Install dependencies and run the complete quality suite:

The suite runs PHP syntax checks, PHPStan, PHP_CodeSniffer, and PHPUnit. This library intentionally does not commit composer.lock, allowing consuming applications to resolve dependencies within their own compatibility constraints.


All versions of container with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
ext-json Version *
gcworld/common Version >=2.7.19
gcworld/database Version >=2.7.1
gcworld/globals Version >=4.0.3
gcworld/interfaces Version >=4.4.12
gcworld/objectmanager Version >=2.8.1
gcworld/orm Version >=6.4.5
gcworld/routing Version >=5.1.2
gcworld/utilities Version >=2.1.3
symfony/yaml Version ^6.4
ramsey/uuid Version ^4.6
psr/container Version ^2.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 gcworld/container contains the following files

Loading the files please wait ...