amir-icecream/frostel

A simple MVC framework

Maintainers

Package info

github.com/amirithm-dev/frostel

Type:project

pkg:composer/amir-icecream/frostel

Statistics

Installs: 4

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2025-07-27 03:07 UTC

This package is auto-updated.

Last update: 2026-06-04 14:08:37 UTC


README

A lightweight, expressive PHP MVC framework built for developers who want full control — without the bloat.

Inspired by Laravel's elegance, built from scratch with PHP 8.2+

✨ Features

  • MVC Architecture — clean separation of Models, Views, and Controllers
  • Custom Router — define routes with full HTTP method support
  • Middleware Support — protect routes with reusable middleware layers
  • Database Migrations — version-controlled schema management
  • Service Layer — keep your business logic organized and testable
  • Blade-style Templating — familiar, expressive view rendering
  • Snowflake CLI — Artisan-inspired command line tool for scaffolding
  • Environment Config.env support via vlucas/phpdotenv
  • Mailer — built-in email support via Symfony Mailer
  • HTTP Client — make external API requests via Symfony HTTP Client
  • Tailwind CSS — frontend styling out of the box
  • PHP 8.2+ — modern PHP, modern code

📦 Installation

Install via Composer:

composer create-project amir-icecream/frostel my-app
cd my-app

Copy the environment file and configure it:

cp .env.example .env

Start the development server using Snowflake:

php Snowflake serve

🗂️ Project Structure

├── app/                  # Controllers, Models
├── config/               # App configuration files
├── core/                 # Framework engine (Router, Console, Helper, etc.)
├── database/
│   └── migrations/       # Database migration files
├── public/               # Entry point (index.php), assets
├── resource/             # Views and templates
├── routes/               # Route definitions
├── services/             # Business logic service classes
├── storage/              # Logs, cache, uploaded files
├── templates/framework/  # Scaffolding templates used by Snowflake CLI
├── vendor/               # Composer dependencies
├── .env                  # Environment variables
├── Snowflake             # CLI tool
└── tailwind.config.js    # Tailwind CSS config

🛣️ Routing

Define your routes in the routes/ directory:

use Core\Router;

Router::get('/home', [HomeController::class, 'index']);
Router::post('/user/create', [UserController::class, 'store']);

// With middleware
Router::get('/dashboard', [DashboardController::class, 'index'])->middleware('auth');

🎮 Snowflake CLI

Frostel ships with Snowflake, a command-line tool for scaffolding and managing your app.

php Snowflake help              # Show all available commands

php Snowflake serve             # Start development server
php Snowflake make:controller UserController
php Snowflake make:model User
php Snowflake make:view dashboard
php Snowflake make:middleware AuthMiddleware
php Snowflake make:migration create_users_table

php Snowflake migrate           # Run all migrations
php Snowflake migrate:reset     # Rollback all migrations
php Snowflake migrate:fresh     # Reset and re-run all migrations

php Snowflake view-fresh        # Clear cached views
php Snowflake delete-logs       # Clear log files

🗃️ Migrations

Create and manage your database schema:

php Snowflake make:migration create_posts_table
php Snowflake migrate

🛡️ Middleware

Create middleware to protect routes or modify requests:

php Snowflake make:middleware AuthMiddleware
namespace App\Middleware;

use Core\Middleware;

class AuthMiddleware extends Middleware
{
    public function handle(): void
    {
        if (!isset($_SESSION['user'])) {
            header('Location: /login');
            exit;
        }
    }
}

📧 Mailer

Send emails using the built-in Symfony Mailer integration:

use Services\MailService;

MailService::send(
    to: 'user@example.com',
    subject: 'Welcome to Frostel',
    body: view('emails.welcome')
);

⚙️ Environment Configuration

All configuration is managed through .env:

APP_NAME=Frostel
APP_ENV=local
APP_URL=http://localhost:8000

DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=frostel
DB_USERNAME=root
DB_PASSWORD=

MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=587
MAIL_USERNAME=
MAIL_PASSWORD=

📋 Requirements

  • PHP ^8.2
  • Composer
  • MySQL or compatible database

📦 Dependencies

Package Purpose
vlucas/phpdotenv Environment variable loading
hekmatinasser/verta Jalali/Persian date support
symfony/mailer Email sending
symfony/http-client HTTP client for external APIs

📄 License

Frostel is open-source software licensed under the GPL-3.0 License.

👤 Author

Built with ❤️ by amirithm-dev