# Intent-Framework **Repository Path**: wfdaj/Intent-Framework ## Basic Information - **Project Name**: Intent-Framework - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-31 - **Last Updated**: 2025-12-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README

PHP 8.2+ Composer Tests PHPStan Level 8 Version

Latest Version Total Downloads CI Status Mutation testing badge

Built by non-expert Time taken AI powered

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.

--- ## ⚑ Quick Look ```php // 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); } // Cache with remember pattern $users = Cache::remember('users', 3600, fn() => DB::table('users')->get() ); // Events Event::listen('user.created', fn($user) => sendWelcomeEmail($user)); event('user.created', $newUser); ``` --- ## πŸ€” 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 This project was posted on r/PHP and got absolutely flamed. Let me own that: | The Criticism | The Reality Now | |---------------|-----------------| | "AI-generated slop" | Yes, AI-assisted β€” and it's clean, tested, and consistent | | "No tests" | **169 tests, 310 assertions** via PHPUnit | | "Incomplete" | v0.5.0 has middleware, auth, sessions, events, cache, CLI, OR conditions, type casting | | "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 | Tool | Level | Status | |------|-------|--------| | **PHPStan** | Level 8 | βœ… Passing | | **Infection** | MSI 74%+ | βœ… Passing | | **PHPUnit** | 169 tests | βœ… Passing | | **GitHub Actions** | CI/CD | βœ… Automated | > All quality checks run automatically on every push and pull request. --- ## ✨ Key Features | Feature | Description | |---------|-------------| | **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' => 'required|email|max:255'` | | **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` | --- ## πŸ“¦ Installation **Option 1: Composer (Recommended)** ```bash composer create-project intent/framework my-app cd my-app php intent serve ``` **Option 2: Clone** ```bash git clone https://github.com/aamirali51/Intent-Framework.git my-app cd my-app composer install ``` --- ## πŸš€ Quick Start ```bash # Start the development server php intent serve # Or manually php -S localhost:8080 -t public ``` Visit **http://localhost:8080** β€” you should see the welcome page. --- ## πŸ› οΈ CLI Commands ```bash php intent --help # Show all available commands php intent serve # Start dev server (port 8080) php intent serve 3000 # Custom port php intent cache:clear # Clear all cached data php intent make:handler # Create a handler class php intent make:middleware # Create a middleware class php intent routes # List registered routes ``` --- ## πŸ“š Documentation - **[API Reference](./API.md)** β€” Complete API with input/output types for every method - **[Architecture](./ARCHITECTURE.md)** β€” Technical docs, directory structure, and internals --- ## πŸ§ͺ Testing ```bash # Run all tests composer test # Or directly vendor/bin/phpunit ``` **Current coverage:** 169 tests, 310 assertions --- ## πŸ’‘ Philosophy ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Zero Boilerplate β”‚ β”‚ ─────────────── β”‚ β”‚ No service containers. No providers. β”‚ β”‚ No facades. No annotations. β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Explicit Over Magic β”‚ β”‚ ────────────────── β”‚ β”‚ Every line does what it says. β”‚ β”‚ No hidden behavior. No surprises. β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ AI-Native Patterns β”‚ β”‚ ───────────────── β”‚ β”‚ Consistent, predictable code that AI β”‚ β”‚ assistants can read and extend correctly. β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ Minimal Abstraction β”‚ β”‚ ─────────────────── β”‚ β”‚ Thin wrappers over PHP. Not frameworks β”‚ β”‚ on top of frameworks. β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## πŸ—ΊοΈ Roadmap - [x] Route groups with shared middleware - [x] CSRF protection middleware - [x] Rate limiting middleware - [x] Logging system (`Log` class + helpers) - [x] Package auto-discovery bootstrap - [ ] `intent/auth` package (OAuth, API tokens) - [ ] Full CMS demo application - [ ] Package ecosystem --- ## 🀝 Contributing Contributions welcome! Especially if you want to prove it's not "slop" πŸ˜„ 1. Fork the repo 2. Create a feature branch 3. Write tests for your changes 4. Submit a PR Check out the [ARCHITECTURE.md](./ARCHITECTURE.md) first to understand the codebase. --- ## πŸ“„ License MIT License. See [LICENSE](./LICENSE) for details. ---

Built with AI assistance by a non-expert. Shipped anyway.

Roast me again on r/PHP if you want. I'll be here shipping v0.4.0.