0
votes
0answers
62 views

When to use packages or Repositories in Laravel?

I'm a Laravel (PHP) developer, and new with DI, Packages (workbench) and Repositories (Pattern). I want to know about the best concept/methodology for a more flexible design; ie. the project can grow ...
1
vote
1answer
90 views

How to properly handle conditional dependencies in a factory?

Let's say you have a string $action run-time, that specifies which type of $object needs to be created: $dbobject, $memcacheobject, $fileobject, $xmlobject, etc. Assume also, that creation of an ...
0
votes
1answer
131 views

Applying DDD to a simple app with a configuration twist

I’m using the light-weight PHP Fat-Free Framework as a base to form a simple MVC based app with DDD philosophy for the Model layer. I’m aware that DDD is most suitable or enterprise solutions and that ...
1
vote
2answers
80 views

Dependency injection for request variables in a web application

I'm working a PHP 5.5/MySQL web application. If a class depends partly on some global GET and POST variables for its members, should I just refer to them directly from within the class, or should I ...
0
votes
0answers
79 views

Customizing configuration for PHP will Laravel 4 IoC be useful?

This topic has been discussed in this post: Customizing configuration with Dependency Injection However - I couldn't find one for PHP syntax and since one of the answers was to use a specific ASP.net ...
0
votes
1answer
180 views

Practical Use of Depency Injection (IoC) Container

I am creating a MVC-ish framework in PHP. I am trying to implement a DI Container to allow the creation of controller objects (among others). My MVC framework is pretty typical. Each module (or ...
0
votes
1answer
220 views

How should dependencies be managed across a modular application?

Let's say that we have a structure like this: Application -- Modules --Module1 -- Controller -- PublicHelper --Module2 -- Controller ...
0
votes
1answer
146 views

Service layer coupling

I am working on writing a service layer for an order system in php. It's the typical scenario, you have an Order that can have multiple Line Items. So lets say a request is received to store a line ...
4
votes
3answers
926 views

Dependency injection: At what point am I allowed to create a new object?

I am refactoring a PHP application, and I am trying to do has much dependency injection (DI) as possible. I feel like I've got a good grasp of how it works, and I can certainly see my classes ...
1
vote
1answer
179 views

Unused dependencies and constructor injection

I have a class that has 3 dependencies. WritabbleDBConnection, ReadOnlyDBConnection and a QueryFilter utility object. I want to do constructor Injection so my class would look something like this. ...
1
vote
1answer
404 views

DB connection Dependency Injection and static creator methods

I often use static "factory" methods to create objects from database. class Job { protected $objDb; public function __construct($objDb) { $this->objDb = $objDb; } public static function ...
2
votes
2answers
272 views

Is functional intellisense and code browsing more beneficial than the use of dependency injection containers

This question is really based on PHP, but could be valid for other dynamically typed, interpreted languages and specifically the methods of generating code insight and object browsing in development ...
6
votes
2answers
385 views

How to use DI and DI containers

I am building a small PHP mvc framework (yes, yet another one), mostly for learning purposes, and I am trying to do it the right way, so I'd like to use a DI container, but I am not asking which one ...
1
vote
1answer
349 views

Are service locators really that bad?

People say Service Locators are bad because they expose the dependencies in some random method from the class (and not in the constructor's arguments like it should): class A{ function F(){ ...
2
votes
2answers
362 views

Is there a better way to design these classes?

I have two business classes: TimesheetDay and TimeSlot. One TimesheetDay can have one or more TimeSlots. The TimesheetDay and TimeSlot classes will be dependent on an object that implements a ...
2
votes
1answer
531 views

Dependency Injection: Only for single-instance objects?

What if I want to also decouple my application, from classes like Product or User? (which usually have more than one instance) Take a look at this example: class Controller { public function ...
9
votes
1answer
1k views

Multiple Zend application code organisation

For the past year I have been working on a series of applications all based on the Zend framework and centered on a complex business logic that all applications must have access to even if they don't ...
8
votes
3answers
933 views

Keeping an MVC model loosely coupled from the DB?

I like to keep my code testable and have decided to go with the Dependency-Injection strategy for my current MVC framework, which definitely has proven to be a great way to ensure loosely coupled ...
1
vote
3answers
408 views

Dependency Injection and method signatures

I've been using YADIF (yet another dependency injection framework) in a PHP/Zend app I'm working on to handle dependencies. This has achieved some notable benefits in terms of testing and decoupling ...