Build. Scale. Automate.

Proprietary — PHP 8.1+

ApnaPHP

File-based routes. Laravel-like ORM. Zero config.

A modern PHP framework with Next.js-inspired file-based routing, ORM, validation and a built-in CLI.

v1.0.0MITPHP 8.1+ · Composer
File-based routingORM & migrationsMulti-databaseCLI toolingValidation

ApnaPHP is a modern PHP framework built by Also Coder. It brings Next.js-style file-based routing to PHP, with a Laravel-like ORM, automatic migrations, hierarchical middleware, 30+ validation rules and a powerful CLI — so you can ship APIs and full-stack apps without boilerplate setup.

We use ApnaPHP for client backends, REST APIs, admin panels and MVPs where PHP hosting is preferred and developers want convention over configuration.

Why ApnaPHP

FeatureBenefit
File-based routingAdd a file → get a route. No route config files.
Eloquent-style ORMModels, relationships, query scopes, auto-migrations
Multi-databaseMySQL, PostgreSQL, SQLite and MongoDB behind one API
Class-based API handlersClean GET / POST methods per route file
Built-in validation30+ rules, file uploads, conditional validation
Zero config defaultsSensible out-of-the-box — customize when you need to

Core features

  • File-based routing — pages and API routes by filesystem layout (Next.js inspired)
  • ORM with auto-migration — Laravel-like models; supports MySQL, PostgreSQL, SQLite, MongoDB
  • Middleware system — hierarchical auth, CORS, security and custom middleware
  • Powerful CLIphp apna make:route, models, migrations, middleware; built-in dev server
  • Advanced validation — file uploads, conditional rules, custom validators
  • File upload system — public/private storage with validation and path handling
  • Error handling — debug pages with stack traces and code preview
  • Console loggingconsole_info(), console_error(), console_debug()
  • SEO & metadata — Open Graph and Twitter Card helpers
  • Layout system — hierarchical layouts with metadata merging
  • Dynamic routes[id], [slug] parameters with automatic matching
  • DI container — service container for clean architecture
  • Security — CSRF, XSS prevention, secure headers, input sanitization

Quick example

Create route.apna.php — class-based handler:

php
<?php
namespace App\Api\Users;

use ApnaPHP\Routing\Request;
use ApnaPHP\Routing\Response;
use App\Models\User;

class UsersHandler {
    public function GET(Request $request) {
        return Response::json([
            'success' => true,
            'users' => User::all()
        ]);
    }
}

No route registration file — the framework discovers routes from your folder structure.

Get started in 3 steps

1. Install dependencies

Bash
composer install

2. Create your first route

Bash
php apna make:route about

3. Start the dev server

Bash
php apna serve

Your app runs at http://localhost:3000 with hot reload during development.

Perfect for

  • PHP startups & MVPs — launch faster with file-based routing and CLI generators
  • REST APIs — class-based handlers, validation and multi-DB support
  • Web applications — full-stack PHP with layouts and metadata
  • Microservices — lightweight services with minimal overhead

What you get out of the box

  • 30+ validation rules — including file uploads and conditional validation
  • 100+ CLI commands — routes, models, migrations, middleware scaffolding
  • 4 database drivers — switch databases without rewriting your app layer
  • Template directives — optional Blade-like @if, @foreach, @include (plain PHP also fine)
  • Production-ready — security headers, CSRF, error handling, logging

Comparison mindset

ApnaPHP sits between “raw PHP” and heavy full-stack frameworks:

  • Faster to start than configuring Laravel/Symfony for small APIs
  • More structure than plain PHP or micro-frameworks
  • Familiar if you know Next.js routing or Laravel models

Built by Also Coder

ApnaPHP is maintained by the same team that ships client projects on Also Coder. Need a PHP API, migration from legacy code, or a full product on ApnaPHP? Use the form on this page.

Links

Build with ApnaPHP

ApnaPHP

Need help integrating ApnaPHP or want a project built on it? Send us a brief — we reply within one working day.

Phone

Build with ApnaPHP

ApnaPHP

Need help integrating ApnaPHP or want a project built on it? Send us a brief — we reply within one working day.

Phone
Work with us

Ready to build something together?

Tell us about your website, app or automation idea. We'll reply with scope, timeline and cost — no sales script.