Skip to content

Alxarafe Microframework – Technical Reference

Alxarafe is a PHP 8.2+ microframework engineered for rapid development of modular web applications and RESTful APIs. It provides a thin, opinionated layer over industry-standard components (Illuminate ORM, Blade templating, Symfony Translation) while strictly following the Convention over Configuration philosophy.

Design Principles

PrincipleDescription
Convention over ConfigurationControllers, models, migrations and templates are discovered automatically by scanning PSR-4 namespaces. No route files to maintain.
Modular by DefaultEvery feature ships as a Module (Modules\), each containing its own Controllers, Models, Migrations, Seeders, and Templates.
Leverage, Don't ReinventDatabase layer = Illuminate/Eloquent. Templates = Blade. Translations = Symfony/Translation. Authentication = JWT (Firebase PHP-JWT).
Attribute-Driven MetadataPHP 8 Attributes (#[Menu], #[ApiRoute], #[RequireRole], #[ModuleInfo]) declaratively define routing, permissions, and module metadata.
Component ArchitectureUI forms are assembled programmatically from Field, Container, and Filter components — not hard-coded HTML.

System Requirements

  • PHP ≥ 8.2
  • Composer
  • Required extensions: ext-pdo, ext-json, ext-openssl
  • Database: MySQL 5.7+ / MariaDB 10.3+ or PostgreSQL 12+

Quick Start

bash
composer create-project alxarafe/alxarafe-template my-app
cd my-app
cp .env.example .env
# Edit .env with your database credentials
php bin/run_migrations.sh

Add to Existing Project

bash
composer require alxarafe/alxarafe

Then create the expected directory structure (see Architecture).

Docker Development

bash
cp .env.example .env
./bin/docker_start.sh
./bin/run_migrations.sh
# Access at http://localhost:8081

Project Structure

text
my-project/
├── config/
│   └── config.json          # Global configuration (DB, security, language)
├── public/                  # Web server Document Root
│   ├── index.php            # Entry point → Dispatcher::run()
│   └── .htaccess            # URL rewrite rules
├── Modules/                 # Application modules (Modules\ namespace)
│   └── MyModule/
│       ├── Controller/      # *Controller.php → Web routes
│       ├── Model/           # Eloquent models
│       ├── Api/             # *Controller.php → API routes
│       ├── Migrations/      # Database migrations
│       ├── Seeders/         # Data seeders
│       └── Templates/       # Blade views
├── templates/               # Shared Blade templates & layouts
├── themes/                  # Theme overrides
└── vendor/                  # Dependencies (includes alxarafe/alxarafe)
    └── alxarafe/alxarafe/
        └── src/
            ├── Core/        # Framework kernel (Alxarafe\ namespace)
            └── Modules/     # Core modules (Modules\ namespace)

Documentation Index

Fundamentals

DocumentDescription
Architecture & Directory StructurePSR-4 namespaces, directory responsibilities, dependency graph
Request LifecycleComplete flow from index.php to HTTP response

API Reference

DocumentDescription
Attributes#[ApiRoute], #[Menu], #[ModuleInfo], #[RequireModule], #[RequirePermission], #[RequireRole]
ControllersGenericControllerViewControllerControllerResourceController hierarchy
Models & TraitsModel, DtoTrait, HasAuditLog
Config & DatabaseConfig, Database, Seeder, Template, BladeContainer
Component Fields15 field types for form generation
Component ContainersPanel, Tab, TabGroup, Row, Separator, HtmlContent
Component FiltersTextFilter, SelectFilter, DateRangeFilter, etc.
Component WorkflowStatusWorkflow, StatusTransition
Lib LayerAuth, Functions, Messages, Router, Routes, Trans
Service LayerHookService, EmailService, PdfService, API services, Markdown
Tools LayerDispatcher, Debug, ModuleManager, DependencyResolver

Guides

DocumentDescription
Admin Module ReferenceBundled Admin module: auth, users, roles, permissions, config, migrations
Advanced UsageCreating modules, hooks, custom fields, themes, JWT, i18n
Template EngineBlade integration and template discovery
Template SchemaComponent-based view structure
Extensible TabsConditional and dynamic tab system
Theme ArchitectureAsset pipeline and theme overrides
Theme SystemTheme installation and customization
Menu ManagerAttribute-driven menu system
ResourceController LifecycleCRUD lifecycle in detail
API DevelopmentREST APIs with JWT authentication
Testing GuidePHPUnit, PHPStan, Psalm configuration
Docker SetupDocker development environment
Publishing GuideVersioning and Packagist publishing
Contribution GuideHow to contribute

License

Alxarafe is released under the GNU General Public License v3.0+ (GPL-3.0-or-later).