PHPackages                             intent/framework - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. intent/framework

ActiveProject

intent/framework
================

AI-native, zero-boilerplate PHP framework

v0.8.2(4mo ago)5111MITPHPPHP ^8.2CI passing

Since Dec 30Pushed 4mo agoCompare

[ Source](https://github.com/aamirali51/Intent-Framework)[ Packagist](https://packagist.org/packages/intent/framework)[ RSS](/packages/intent-framework/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (17)Used By (0)

 [![PHP 8.2+](https://camo.githubusercontent.com/a4fd7d09ed2999b09476b31a2257dfa8ef0fc4b19468a05519c72322841d9ab2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322b2d3838393242463f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/a4fd7d09ed2999b09476b31a2257dfa8ef0fc4b19468a05519c72322841d9ab2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322b2d3838393242463f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465) [![Composer](https://camo.githubusercontent.com/5d6f3846fcac4148d1321669039238591d1977912bef61f62070b20304c22324/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6d706f7365722d5053522d2d342d3838353633303f7374796c653d666f722d7468652d6261646765266c6f676f3d636f6d706f736572266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/5d6f3846fcac4148d1321669039238591d1977912bef61f62070b20304c22324/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6d706f7365722d5053522d2d342d3838353633303f7374796c653d666f722d7468652d6261646765266c6f676f3d636f6d706f736572266c6f676f436f6c6f723d7768697465) [![Tests](https://camo.githubusercontent.com/8552294d715f3ec9f3d1c3a4d9a1f54eb0079f1ca2a32cac2622f68a192bd6f3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d32323025323050617373696e672d627269676874677265656e3f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/8552294d715f3ec9f3d1c3a4d9a1f54eb0079f1ca2a32cac2622f68a192bd6f3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54657374732d32323025323050617373696e672d627269676874677265656e3f7374796c653d666f722d7468652d6261646765) [![PHPStan Level 9](https://camo.githubusercontent.com/dcd855ec8171f39727cfde254dc61f5523177c07153863ad7825130df9c3ebcc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230392d3461646538303f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/dcd855ec8171f39727cfde254dc61f5523177c07153863ad7825130df9c3ebcc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230392d3461646538303f7374796c653d666f722d7468652d6261646765) [![Version](https://camo.githubusercontent.com/a2cb8f0df936719d9f4e685ac601f27c9691be25df9f64900009bcfad7f93f9f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f61616d6972616c6935312f496e74656e742d4672616d65776f726b3f7374796c653d666f722d7468652d6261646765266c6162656c3d56657273696f6e)](https://camo.githubusercontent.com/a2cb8f0df936719d9f4e685ac601f27c9691be25df9f64900009bcfad7f93f9f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f61616d6972616c6935312f496e74656e742d4672616d65776f726b3f7374796c653d666f722d7468652d6261646765266c6162656c3d56657273696f6e)

 [![Latest Version](https://camo.githubusercontent.com/4b9ff2f8dfd324741a7d5caec6b2c3a2ef721f9e7981654f4cc438287a68af3e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e74656e742f6672616d65776f726b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/intent/framework) [![Total Downloads](https://camo.githubusercontent.com/abd71bdf3dcc5faa530550bf8d3804406d7517771993fa06c5b5eecbb1f3c896/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f696e74656e742f6672616d65776f726b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/intent/framework) [![CI Status](https://github.com/aamirali51/Intent-Framework/actions/workflows/ci.yml/badge.svg)](https://github.com/aamirali51/Intent-Framework/actions)

 [![Built by non-expert](https://camo.githubusercontent.com/48bce72d6062f5fa02db6c1ad643b08fc1c35a12243a5db5dff048101cc092eb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275696c745f62792d6e6f6e5f6578706572742d7265642e737667)](https://camo.githubusercontent.com/48bce72d6062f5fa02db6c1ad643b08fc1c35a12243a5db5dff048101cc092eb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275696c745f62792d6e6f6e5f6578706572742d7265642e737667) [![Time taken](https://camo.githubusercontent.com/97a9bab1b101968526818591c9a4b6fb9fe02ef9ba7712fea4b794397e94c414/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54696d652d3c315f7765656b656e642d677265656e2e737667)](https://camo.githubusercontent.com/97a9bab1b101968526818591c9a4b6fb9fe02ef9ba7712fea4b794397e94c414/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54696d652d3c315f7765656b656e642d677265656e2e737667) [![AI powered](https://camo.githubusercontent.com/18129cecd8f45aedcf8d54a67e47c01e786fa03e14b7bca643df582853933b41/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f41492d706f77657265642d626c75652e737667)](https://camo.githubusercontent.com/18129cecd8f45aedcf8d54a67e47c01e786fa03e14b7bca643df582853933b41/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f41492d706f77657265642d626c75652e737667)

Intent Framework
================

[](#intent-framework)

 **A zero-boilerplate, AI-native, explicitly designed PHP micro-framework**

 ~3,000 lines of core code. No magic. No facades. No providers.
 Just PHP that reads like English.

 *Yes, most of this was written by AI. Yes, I'm not a PHP expert. No, I don't care.*

> ⚠️ **Early Development** — Intent is functional and tested (220 tests, 393 assertions!), but it's still young. Perfect for side projects, learning, and experimentation. Not yet battle-tested in production. Bugs? Probably. PRs? Welcome.

---

⚡ Quick Look
------------

[](#-quick-look)

```
// Route with middleware
Route::get('/dashboard', fn($req, $res) => $res->json([
    'user' => user(),
    'stats' => cache('dashboard_stats'),
]))->middleware(AuthMiddleware::class);

// Validation
$v = validate($request->json(), [
    'email' => 'required|email',
    'password' => 'required|min:8',
]);

if ($v->fails()) {
    return $response->json(['errors' => $v->errors()], 422);
}

// Database (v0.8+ helper syntax)
$users = db()->table('users')->get();

// Cache with remember pattern
$stats = cache()->remember('stats', 3600, fn() =>
    db()->table('stats')->first()
);

// Events
Event::listen('user.created', fn($user) => sendWelcomeEmail($user));
event('user.created', $newUser);
```

---

🤔 Why Intent Exists
-------------------

[](#-why-intent-exists)

I was tired of:

- **Laravel's 100k+ lines** and magic I couldn't trace
- **Facades and containers** that hide what's actually happening
- **Convention over configuration** that confused AI assistants
- **Frameworks that require a PhD** to understand the request lifecycle

I wanted something:

- **Simple enough for AI to generate correct code** consistently
- **Explicit enough that I could read any file** and understand it
- **Small enough to learn in one sitting** (~3k lines total)
- **Powerful enough to build real apps** without reaching for Laravel

Intent is that framework.

---

🔥 Addressing the Roasts
-----------------------

[](#-addressing-the-roasts)

This project was posted on r/PHP and got absolutely flamed. Let me own that:

The CriticismThe Reality Now"AI-generated slop"Yes, AI-assisted — and it's clean, tested, and consistent"No tests"**220 tests, 393 assertions** via PHPUnit"Incomplete"v0.8.1 has middleware, auth, sessions, events, cache, CLI, registry proxies"No Composer"Full `composer.json`, PSR-4 autoloading, proper `vendor/`"Bad structure"`public/` separation, `src/Core/` for framework, `app/` for user code"Just use Laravel"Sure — if you want facades and service containers. This is the opposite.> The whole point of Intent is that it's **readable, predictable, and AI-friendly**.
> Whether a human or an AI writes the code, it should be obvious what it does.

---

🛡️ Quality Gates
----------------

[](#️-quality-gates)

ToolLevelStatus**PHPStan**Level 9✅ Passing| **PHPUnit** | 220 tests | ✅ Passing | | **GitHub Actions** | CI/CD | ✅ Automated |

> All quality checks run automatically on every push and pull request.

---

✨ Key Features
--------------

[](#-key-features)

FeatureDescription**Immutable Request**Readonly properties, no mutation bugs**Fluent Response**`$res->status(201)->json($data)`**Middleware Pipeline**Per-route, no global stack magic**Session + Flash**`session('key')`, `flash('success', 'Saved!')`**Auth**`auth()->attempt()`, `user()`, password hashing**Events**Simple dispatcher: `event('user.created', $user)`**Cache**File-based: `Cache::remember('key', 3600, $fn)`**Validator**18 rules: `'email' =&gt; 'required**Query Builder**OR conditions, type casting, multi-DB support**Dev Schema**Auto-creates tables in dev mode (disabled in prod)**Secure File Routes**Outside `public/`, in `app/Api/`**CLI Tool**`php intent serve`, `php intent make:handler`**Registry Proxies**Type-safe service access with PHPStan Level 9 support---

🔄 Service Access Pattern (v0.8+)
--------------------------------

[](#-service-access-pattern-v08)

All services are accessed via **registry-backed helpers** for consistency and testability:

```
// ✅ Canonical pattern (v0.8+)
db()->table('users')->where('id', 1)->first();
auth()->user();
cache('key', $value, 3600);
session('user_id');
logger()->info('Message');

// ❌ Deprecated (still works, avoid in new code)
DB::table('users')->get();  // Use db() instead
Cache::put('key', $value);  // Use cache() instead
```

> Static facades will be removed in v2.0. Use helpers for new code.

---

📦 Installation
--------------

[](#-installation)

**Option 1: Composer (Recommended)**

```
composer create-project intent/framework my-app
cd my-app
php intent serve
```

**Option 2: Clone**

```
git clone https://github.com/aamirali51/Intent-Framework.git my-app
cd my-app
composer install
```

**Option 3: Using as Library**

If you want to use Intent Framework as a dependency in an existing project:

```
composer require intent/framework
```

**Important Notes:**

1. **Define `BASE_PATH` first** — Must be set before anything else
2. **Let `Core\App` handle initialization** — Don't load routes manually before App is constructed
3. **Config uses flat dot-notation keys** — e.g., `'app.name'`, not nested arrays

**Example bootstrap:**

```
