Yes and no. It works, but this particular code can lead to a number of problems.
You should be using
require_once
instead ofrequire
to avoid possible errors of including the same file twice. As it is this code here will bring your app to a complete stop:new ArticlesHandler; new ArticlesHandler;
This creates a hard coupling to the
Articles
class. You should probably rather be using dependency injection and pass an instance ofArticle
to the constructor ofArticlesHandler
. See How Not To Kill Your Testability Using Statics.