Download the PHP package divineniiquaye/rade-di without Composer

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

# The PHP Rade DI [![PHP Version](https://img.shields.io/packagist/php-v/divineniiquaye/rade-di.svg?style=flat-square&colorB=%238892BF)](http://php.net) [![Latest Version](https://img.shields.io/packagist/v/divineniiquaye/rade-di.svg?style=flat-square)](https://packagist.org/packages/divineniiquaye/rade-di) [![Workflow Status](https://img.shields.io/github/workflow/status/divineniiquaye/rade-di/build?style=flat-square)](https://github.com/divineniiquaye/rade-di/actions?query=workflow%3Abuild) [![Code Maintainability](https://img.shields.io/codeclimate/maintainability/divineniiquaye/rade-di?style=flat-square)](https://codeclimate.com/github/divineniiquaye/rade-di) [![Coverage Status](https://img.shields.io/codecov/c/github/divineniiquaye/rade-di?style=flat-square)](https://codecov.io/gh/divineniiquaye/rade-di) [![Psalm Type Coverage](https://img.shields.io/endpoint?style=flat-square&url=https%3A%2F%2Fshepherd.dev%2Fgithub%2Fdivineniiquaye%2Frade-di%2Fcoverage)](https://shepherd.dev/github/divineniiquaye/rade-di) [![Quality Score](https://img.shields.io/scrutinizer/g/divineniiquaye/rade-di.svg?style=flat-square)](https://scrutinizer-ci.com/g/divineniiquaye/rade-di)

divineniiquaye/rade-di is a HIGH performance smart tool for performing simple to complex dependency injection in your application for PHP 7.4+ created by Divine Niiquaye referenced to Nette DI and Pimple. This library provides an advance way of resolving services for best performance to your application.

Rade DI was born after frustration using Symfony DI and Nette DI on several projects. Autowiring feature in Nette is much more simpler than that of symfony's. No doubt they all great to use, but I wanted a DI which allows me focus on writing code than configuring the DI. Initially was a simple container, but over time managed to include most essential features.

This project adheres to a code of conduct. By participating in this project and its community, you are expected to uphold this code.

πŸ“¦ Installation & Basic Usage

This project requires PHP 7.4 or higher. The recommended way to install, is via Composer. Simply run:

Creating a container is a matter of creating a Container instance:

For registering services into container, a service must be a real valid PHP object type. Container implements both PSR-11 ContainerInterface and ArrayAccess, so here's an example to demonstrate:

Using Container without ArrayAccess

Using Container with ArrayAccess

Using the defined services is also very easy:

Container supports reuseable service instance. This is means, a registered service which is resolved, is frozen and object's id does not change throughout your application using Rade DI.

Rade DI also supports autowiring except a return type of a callable is not define or better still if you do not want autowiring at all, use the container's set method. By default, registering services with ArrayAccess implementation are all autowired.

With the example above, each call to $container['session'] returns a new instance of the session. Also Rade has aliasing and tagging support for services. If you want to add a different name to a registered service, use alias method.

For tagging, perhaps you are building a report aggregator that receives an array of many different Report interface implementations.

Once the services have been tagged, you may easily resolve them all via the tagged method:

Since PHP 8 release, container supports injecting services to public class properties and public class methods using an attribute named #[Inject]. If a value is not provided for the attribute it uses type declaration on either public class properties or public class methods typed parameter(s).

For performance reasons, this feature is locked to classes implementing Rade\DI\Injector\InjectableInterface, and can be resolved using the container's call method or container resolver's resolveClass method.

Eg: Dependency Service1 will be passed by calling the injectService1 method, dependency Service2 will be assigned to the $service2 property:

Before the PHP's 8 #[Inject] attribute, rade di supported autowiring using phpdoc type and still support's with plans to remove after PHP 8.2 release. The #[Inject] attribute is an advanced autowiring, as long as the value is resolvable by the container, it doesn't mind.

Rade Di has extensions support, which allows the container to be extensible and reuseable. With Rade DI, your project do not need so to depend on PSR-11 container so much. Using service providers in your project, saves you alot.

Then, register the provider on a Container:

Service providers support Symfony's config component for writing configuration for service definitions found in a provider. Implement the service provider class to Symfony\Component\Config\Definition\ConfigurationInterface.

Writing configurations for a service provider by default, the service provider's class name, becomes the key pointing to the require config data. Want to use a custom key name, set add a static getId method returning your custom key name.

Using Symfony's config component + Rade\DI\ContainerBuilder class is highly recommended.

Also the Rade\DI\ServiceLocator class is intended of setting predefined services while instantiating them only when actually needed.

For service locators, Rade uses symfony's service contracts.

It also allows you to make your services available under different naming. For instance, you may want to use an object that expects an instance of EventDispatcherInterface to be available under the name event_dispatcher while your event dispatcher has been registered under the name dispatcher:

πŸ““ Documentation

For in-depth documentation before using this library. Full documentation on advanced usage, configuration, and customization can be found at docs.divinenii.com.

⏫ Upgrading

Information on how to upgrade to newer versions of this library can be found in the UPGRADE.

🏷️ Changelog

SemVer is followed closely. Minor and patch releases should not introduce breaking changes to the codebase; See CHANGELOG for more information on what has changed recently.

Any classes or methods marked @internal are not intended for use outside of this library and are subject to breaking changes at any time, so please avoid using them.

πŸ› οΈ Maintenance & Support

(This policy may change in the future and exceptions may be made on a case-by-case basis.)

When a major version is released, the number of minor versions is limited to five per branch (X.0, X.1, X.2, X.3 and X.4). The last minor version of a branch (e.g. 1.4, 2.4) is considered a long-term support (LTS) version with lasts for more that 2 years and the other ones cam last up to 8 months:

Get a professional support from Biurad Lap after the active maintenance of a released version has ended.

πŸ§ͺ Testing

This will tests divineniiquaye/rade-di will run against PHP 7.4 version or higher.

πŸ›οΈ Governance

This project is primarily maintained by Divine Niiquaye Ibok. Contributions are welcome πŸ‘·β€β™€οΈ! To contribute, please familiarize yourself with our CONTRIBUTING guidelines.

To report a security vulnerability, please use the Biurad Security. We will coordinate the fix and eventually commit the solution in this project.

πŸ™Œ Sponsors

Are you interested in sponsoring development of this project? Reach out and support us on Patreon or see https://biurad.com/sponsor for a list of ways to contribute.

πŸ‘₯ Credits & Acknowledgements

πŸ“„ License

The divineniiquaye/rade-di library is copyright Β© Divine Niiquaye Ibok and licensed for use under the .


All versions of rade-di with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
nette/utils Version ^3.2
psr/container Version ^1.1|^2.0
symfony/service-contracts Version ^1.1.6|^2
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 divineniiquaye/rade-di contains the following files

Loading the files please wait ....