Download the PHP package snicco/kernel without Composer

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

Snicco-Kernel: A bootstrapper for applications with a plugin architecture

codecov Psalm Type-Coverage Psalm level PhpMetrics - Static Analysis PHP-Versions

The Kernel component of the Snicco project helps to bootstrap an application that uses a plugin architecture.

Table of contents

  1. Installation
  2. Definitions
    1. Kernel
    2. Bootstrappers
    3. Bundles
    4. Environment
    5. Directories
    6. Configuration files
  3. Usage
    1. Creating kernel
    2. Booting the kernel
    3. Lifecycle hooks
    4. Using the booted kernel
  4. Contributing
  5. Issues and PR's
  6. Security

Installation

Definitions

Kernel

The Kernel class helps to load and cache configuration files, define services in a dependency-injection container and bootstrap an application in a controlled manner using any number of bundles.


Bootstrappers

A bootstrapper can be any class that implements the Bootstrapper interface:

A bootstrapper is a class responsible for "bootstrapping" one cohesive part of an application.

"Bootstrapping" could mean, for example: registering definitions in a dependency injection container or creating event listeners.

Bootstrappers are the central place to configure the application.


Bundles

A bundle can be any class that implements the Bundle interface extends the Bootstrapper interface.

The difference between a bundle and a bootstrapper is that a bundle is meant to be publicly distributed, while a bootstrapper is internal to a specific application.

Bundles are aware of other bundles that are used by the same Kernel instance.


Environment

A Kernel always needs an environment to run in.

The following environments are possible:


Directories

A Directories value object that defines the location of:


Dependency injection container

The DIContainer, which is an abstract class that extends the PSR-11 container interface.

There are currently two implementations of this interface:

You can also provide your own implementation and test it using the test cases in snicco/kernel-testing.

The bundles.

Since bundles are distributed packages, they can't rely on a specific dependency-injection container. However, the PSR-11 container interface only defines how to fetch services from the container, not how to define them, which is why the DIContainer abstraction is used.


Configuration files

Every .php file inside the config directory will be used to create a Config instance once the kernel is booted.

The following configuration inside your config directory:

would be loaded into the config instance like so:

The kernel.php configuration file is reserved since this is where bundles and bootstrappers are defined:

Usage

Creating a kernel


Booting a kernel

There is a difference in what happens when the kernel is booted based on the current environment and whether the configuration is already cached.

Booting an "uncached" kernel:

  1. All configuration files inside the config directory will be loaded from disk to create an instance of WritableConfig.
  2. The bundles and bootstrappers are read from the kernel.php configuration file.
  3. The shouldRun() method is called for all bundles.
  4. The shouldRun() method is called for all bootstrappers.
  5. The configure() method is called for all bundles.
  6. The configure() method is called for all bootstrappers.
  7. The WritableConfig is combined into one file and written to the cache directory (if the current environment is production/staging).
  8. The register() method is called for all bundles.
  9. The register() method is called for all bootstrappers.
  10. The boot() method is called for all bundles that are defined in the kernel.php configuration file.
  11. The boot() method is called for all bootstrappers that are defined in the kernel.php configuration file.
  12. The DIContainer is locked and no further modifications can be made.

Booting a "cached" kernel:

  1. The cached configuration file is loaded from disk and a ReadOnlyConfig is created.
  2. The bundles and bootstrappers are read from the ReadOnlyConfig.
  3. The shouldRun() method is called for all bundles.
  4. The shouldRun() method is called for all bootstrappers.
  5. The register() method is called for all bundles.
  6. The register() method is called for all bootstrappers.
  7. The boot() method is called for all bundles.
  8. The boot() method is called for all bootstrappers.
  9. The DIContainer is locked and no further modifications can be made.

Each of these methods is always called first on all bundles, then on all bootstrappers.

This allows bootstrappers to customize behaviour of bundles (if desired).


Lifecycle hooks

There are two extension points in the booting process of the kernel.


Using the booted kernel

After the container is booted, services provided by all bundles can be safely fetched.

An example:

Contributing

This repository is a read-only split of the development repo of the Snicco project.

This is how you can contribute.

Reporting issues and sending pull requests

Please report issues in the Snicco monorepo.

Security

If you discover a security vulnerability, please follow our disclosure procedure.


All versions of kernel with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
psr/container Version ^1.1
snicco/str-arr Version ^2.0
webimpress/safe-writer Version ^2.2
webmozart/assert Version ^1.10
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 snicco/kernel contains the following files

Loading the files please wait ....