Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/giuseppe998e/syringe
Dependency injection library for PHP8
https://github.com/giuseppe998e/syringe
autowired bean component configuration dependencies dependency-injection inject injection injector php php8 php80 php81 provides repository
Last synced: 4 months ago
JSON representation
Dependency injection library for PHP8
- Host: GitHub
- URL: https://github.com/giuseppe998e/syringe
- Owner: giuseppe998e
- License: apache-2.0
- Created: 2022-09-29T10:34:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-10-26T10:18:14.000Z (over 2 years ago)
- Last Synced: 2024-09-29T20:04:06.488Z (4 months ago)
- Topics: autowired, bean, component, configuration, dependencies, dependency-injection, inject, injection, injector, php, php8, php80, php81, provides, repository
- Language: PHP
- Homepage:
- Size: 45.9 KB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Syringe
Dependency injection library for PHP8.## Usage
#### The configuration class:```php
prepare('SELECT * FROM users WHERE id=?');
$stmt->execute([$id]);
return $stmt->fetch();
}
}```
#### Initialize Syringe:
```php
addConfiguration(DbConfiguration::class);
// $repo->addConfiguration(OtherConfiguration::class);
Syringe::initialize($repo);$testClass = Syringe::new(TestClass::class);
$user = $testClass->getUserById(1);
var_dump($user);// ...
```