DEV Community

Joshua Johnson
Joshua Johnson

Posted on

1

PHP Dependency Injection The Easy Way

Hey guys,

About 6 or 7 years ago I wrote a little PHP library that ended up becoming the a core part of a framework I built out for a project I was working on. I wanted to have a good dependency injection engine for my project but was not happy with the DI's that were available at the time. So I decided to make a very simple DI engine that is easy to understand.

https://github.com/joshualjohnson/ulfberht

I just wanted to share it because it's been a while since I've shared it. If you're looking for a good DI engine for your next PHP project, this is a good solution.

I was thinking about moving it over to my Org (https://github.com/ua1-labs) and officially supporting it again. This will depend on if anyone else sees a need for it.

Future feature updates:

  • Add a put($className, $object) method that will allow you to put and override instances within the DI container.
  • Update the project to become part of the Fire family. Rename it to FireDI.
  • Add Unit Testing with FireTest.

What features do you need in a DI?

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more