Skip to main content

2 posts tagged with "noor"

View All Tags

The Challenges of Building a Single-File PHP Framework

· 4 min read
Noor Team
Framework Maintainer

Building a framework in a single file sounds like a constraint you'd impose for fun. And it was fun. But it also forced some interesting trade-offs that are worth documenting.

1. Namespace Management in a Flat File

Without Composer's PSR-4 autoloader, every class lives in the global namespace. That means class name collisions are a real possibility if the user brings in external libraries or defines their own classes.

The solution was a simple spl_autoload_register at the bottom of noor.php that checks the project root, controllers/, and models/ directories. User classes take priority over framework internals. This buys reasonable interoperability without compromising the single-file constraint.

Why Noor — A Single-File PHP Framework for Shared Hosting

· 3 min read
Noor Team
Framework Maintainer

Every PHP developer eventually faces the same deployment reality: shared hosting. cPanel, Plesk, or a basic LAMP stack with FTP access and nothing else. No SSH. No Composer. No Node.js. No chance of running artisan or bin/console.

Modern PHP frameworks assume a modern environment. Laravel needs Composer, vendor/, and often Redis or a queue worker. Symfony is similar. Even Slim requires Composer and an autoloader. On shared hosting, you're lucky to get PHP 7.4 with mod_rewrite.

So you reach for WordPress. Or you hand-roll everything with require_once spaghetti. Neither is satisfying.