Download the PHP package joby/smol-context without Composer

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

smolContext

A lightweight dependency injection container with config integration and docblock-driven file inclusion.

Installation

About

smolContext provides a simple, static dependency injection container for PHP. Services are registered and automatically instantiated with their dependencies when retrieved.

Key features:

Basic Usage

Registering and Retrieving Services

Registration Aliasing

By default, services are registered only under their exact class name. This explicit behavior prevents surprises and makes dependencies clear. However, you can optionally register a service under additional class names using the also parameter.

When to use also:

Creating Transient Objects

Build objects without caching them in the container:

Checking for Services

Executing Callables with Injection

Execute callables with automatic parameter injection:

Type-hinted object parameters are automatically resolved from the container.

Config Integration

Every container includes a config service (backed by joby/smol-config). Inject config values using the #[ConfigValue] attribute:

Mixing Config and Object Injection

Including Files with Docblock Injection

Include PHP files with variables injected from docblock annotations. This is useful for templates, scripts, or configuration files that need access to services.

The Include File

Create a file with dependencies declared in its opening docblock (report.php):

Including the File

Config Injection in Included Files

Docblocks don't support real PHP attributes, so config injection uses a string that looks like an attribute on the line immediately before @var. This isn't actually an attribute, and you don't even need to formally use the attribute class, it's just so that the syntax is familiar.

Type Resolution

Object types can be:

Context Stack

The context actually maintains an internal stack of containers, allowing temporary scopes for testing, isolated operations, or rollback workflows.

Cloning the Current Container

Starting with an Empty Container

Using a Custom Container

Resetting Completely

Usage Patterns

Request-Scoped Services

Interface-Based Dependency Injection

Background Jobs

Template Rendering

Create template files that get services injected (templates/email.php):

Render templates with automatic injection:

API Reference

Static Context Methods

Stack Operations

Requirements

Fully tested on PHP 8.3+, static analysis for PHP 8.1+.

License

MIT License - See LICENSE file for details.


All versions of smol-context with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
joby/smol-cache Version ^1.0
joby/smol-config 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 joby/smol-context contains the following files

Loading the files please wait ...