Current SqueHub versionv2.0.0
Getting started Β· v1.x

Directory structure

πŸ“ Squehub Project Directory Structure After installing Squehub, your project will have the following directory structure. Each folder is designed with a specific purpose to help maintain a clean and scalable application. myapp/ β”œβ”€β”€ app/ #…

Historical v1.x reference. These examples describe the original API. Read the current v2.x guides or the upgrade guide.

πŸ“ Squehub Project Directory Structure

After installing Squehub, your project will have the following directory structure. Each folder is designed with a specific purpose to help maintain a clean and scalable application.

CODE

myapp/
β”œβ”€β”€ app/                                  # Core application and framework source files
β”‚   β”œβ”€β”€ Clis/                             # CLI command logic and generators
β”‚   β”‚   β”œβ”€β”€ dump/                         # Data dumpers (seeders)
β”‚   β”‚   β”‚   └── dump.php                  # Data dumping entry point
β”‚   β”‚   β”œβ”€β”€ make/                         # Code generators for controllers, models, etc.
β”‚   β”‚   β”‚   β”œβ”€β”€ MakeController.php       
β”‚   β”‚   β”‚   β”œβ”€β”€ MakeDumper.php            
β”‚   β”‚   β”‚   β”œβ”€β”€ MakeMiddleware.php        
β”‚   β”‚   β”‚   β”œβ”€β”€ MakeMigration.php         
β”‚   β”‚   β”‚   └── MakeModel.php             
β”‚   β”‚   └── clis.php                      # CLI command registry
β”‚   β”œβ”€β”€ Components/                       # Blade-like directive handlers
β”‚   β”‚   β”œβ”€β”€ ControlStructuresComponent.php # @if, @foreach, etc.
β”‚   β”‚   β”œβ”€β”€ DateTimeComponent.php         # @date, @time, @datetime directives
β”‚   β”‚   └── Notification.php              # Flash notifications handling
β”‚   β”œβ”€β”€ Core/                             # Core framework engine classes
β”‚   β”‚   β”œβ”€β”€ Exceptions/                   # Custom exception handlers
β”‚   β”‚   β”‚   β”œβ”€β”€ CustomPrettyPageHandler.php
β”‚   β”‚   β”‚   └── debug.php                 
β”‚   β”‚   β”œβ”€β”€ Controller.php                # Base controller class
β”‚   β”‚   β”œβ”€β”€ Database.php                  # Database connection and query handling (PDO wrapper)
β”‚   β”‚   β”œβ”€β”€ Dumper.php                    # Base dumper class for seeders
β”‚   β”‚   β”œβ”€β”€ Helper.php                    # Global helper functions
β”‚   β”‚   β”œβ”€β”€ Mail.php                      # Mail sending functionality
β”‚   β”‚   β”œβ”€β”€ MiddlewareHandler.php        # Middleware management
β”‚   β”‚   β”œβ”€β”€ Model.php                     # Base ORM-style model class
β”‚   β”‚   β”œβ”€β”€ Notification.php              # Notification dispatcher
β”‚   β”‚   β”œβ”€β”€ Service.php                   # Base service layer class
β”‚   β”‚   β”œβ”€β”€ Task.php                      # Cron-style scheduled task base
β”‚   β”‚   β”œβ”€β”€ Verification.php              # Email/SMS/code verification logic
β”‚   β”‚   └── View.php                      # Blade-like template engine
β”‚   └── Routes/
β”‚       └── web.php                       # Default application route definitions
β”‚
β”œβ”€β”€ assets/                               # Frontend assets (optional)
β”‚   β”œβ”€β”€ css/
β”‚   β”œβ”€β”€ js/
β”‚   └── images/
β”‚
β”œβ”€β”€ config/                               # App-wide configuration files
β”‚   β”œβ”€β”€ debug.php                         # Debug settings
β”‚   └── mail.php                          # Mail server credentials
β”‚
β”œβ”€β”€ database/                             # Database-related files
β”‚   β”œβ”€β”€ dumper/                           # Seeder files
β”‚   β”œβ”€β”€ migrations/                       # Database migration scripts
β”‚   └── mg.sql                            # Optional SQL schema dump
β”‚
β”œβ”€β”€ project/                             # Developer's business logic & custom code
β”‚   β”œβ”€β”€ controllers/                      # Project-level controllers
β”‚   β”œβ”€β”€ Middleware/                       # Project-specific middleware
β”‚   β”œβ”€β”€ Models/                           # Project-specific models
β”‚   β”œβ”€β”€ Utils/                           # Project-level utility classes and helper functions
β”‚   β”‚                                      
β”‚   β”œβ”€β”€ Views/                           # Project-specific Blade-like templates (overrides or custom views)
β”‚   β”œβ”€β”€ Package/                          # Local packages or feature modules
β”‚   └── Routes/                          # Project-level route files
β”‚
β”œβ”€β”€ public/                              # Public web root
β”‚   β”œβ”€β”€ assets/                          # Public static assets
β”‚   β”œβ”€β”€ .htaccess                        # Apache URL rewrite rules
β”‚   └── index.php                       # Web app entry point
β”‚
β”œβ”€β”€ scripts/                            # Install & helper scripts
β”‚   └── message/                        # CLI/install messages
β”‚
β”œβ”€β”€ storage/                            # Generated files, caches, logs, backups
β”‚   └── backups/
β”‚       └── dev/                       # Developer backup zips
β”‚
β”œβ”€β”€ vendor/                            # Composer dependencies
β”‚
β”œβ”€β”€ views/                             # Framework root Blade-like UI templates
β”‚   β”œβ”€β”€ layouts/                       # Layout templates with @yield sections
β”‚   β”œβ”€β”€ partials/                      # Shared view snippets like headers, footers, navbars
β”‚   β”œβ”€β”€ default/
β”‚   β”‚   └── error/
β”‚   β”‚       β”œβ”€β”€ 404.php                # Plain fallback error page
β”‚   β”‚       β”œβ”€β”€ 404.squehub.php       # Custom 404 template
β”‚   β”‚       β”œβ”€β”€ 500.php                # Plain 500 fallback page
β”‚   β”‚       └── 500.squehub.php       # Custom 500 template
β”‚   └── home/
β”‚       β”œβ”€β”€ welcome.squehub.php       # Default homepage
β”‚       └── welcome2.squehub.php      # Alternate example view
β”‚
β”œβ”€β”€ .env                              # Environment configuration (not committed)
β”œβ”€β”€ .gitignore                       # Git exclusions
β”œβ”€β”€ .htaccess                        # Apache routing (root/fallback)
β”œβ”€β”€ bootstrap.php                   # Framework bootstrapper
β”œβ”€β”€ composer.json                   # Project package config
β”œβ”€β”€ composer.lock                   # Locked dependencies
β”œβ”€β”€ config.php                      # Global config bootstrap
β”œβ”€β”€ index.php                      # Root fallback entry point
β”œβ”€β”€ Router.php                     # Core routing engine
β”œβ”€β”€ squehub                       # CLI launcher file
└── README.md                     # Project documentation

πŸ“˜ Quick Summary of Key Folders

  • /app/ – Core application logic, CLI tools, and framework engine files.
  • /views/ – Framework root Blade-like templates using the .squehub.php extension.
  • /project/Views/ – Project-specific view templates allowing overrides or custom UI views.
  • /project/Utils/ – Project-level utilities, helper classes, and functions (auto-loaded globally).
  • /config/ – Application configuration files such as mail and debug settings.
  • /project/ – Developer-defined business logic: controllers, middleware, models, packages, routes, and utilities.
  • /database/ – Database migration and seeder files.
  • /public/ – Public web root for static assets and entry point.
  • /storage/ – Generated files, caches, logs, and backups.

πŸ’‘ Tip:

For security and proper routing, configure your production server to use /public as the web root.
Use the root-level index.php only on shared hosting environments without document root control.

πŸ“‚ Detailed Explanation of Squehub Directories

This section expands on the structure above, explaining the purpose and typical contents of each main directory.

πŸ”§ /app/ – Core Application Logic

  • /Clis/ – Contains CLI tools and command generators:
    • /dump/ – Data seeders or dumpers for populating database test data.
    • /make/ – Code generator classes for scaffolding controllers, models, migrations, middleware, etc.
    • clis.php – CLI command registry for all commands.
  • /Components/ – Blade-like template directive processors:
    • ControlStructuresComponent.php – Handles directives like @if, @foreach, etc.
    • DateTimeComponent.php – Renders date/time directives (@date, @time).
    • Notification.php – Manages flash and alert message rendering.
  • /Core/ – Core framework engine classes:
    • Database.php – PDO database connection and query wrapper.
    • Model.php – Base ORM model class.
    • View.php – Blade-like templating engine handling .squehub.php files.
    • Controller.php, MiddlewareHandler.php, Helper.php – Core routing, middleware, and helper utilities.
    • Task.php – Base class for scheduled (cron) tasks.
    • Verification.php – Logic for email/SMS/code verification.
    • Notification.php – Notification dispatch system.
    • Mail.php – Mail sending functionality.
    • Exceptions/ – Custom error handlers.
  • /Routes/ – Core framework routes (e.g., web.php).

πŸ’Ό /project/ – Developer Logic

  • /controllers/ – Project-specific controllers (e.g., AuthController.php).
  • /Middleware/ – Custom middleware classes like AuthMiddleware.php.
  • /Models/ – Business domain models extending the core Model class.
  • /Utils/ – Project utilities, helper classes, and functions (auto-loaded globally).
  • /Views/ – Project-specific Blade-like templates allowing overrides or additional views.
  • /Package/ – Local packages or feature modules.
  • /Routes/ – Application-specific route definitions.

πŸ—‚ /views/ – Framework Root Blade-like UI Templates

  • /layouts/ – Base layout templates with @yield placeholders.
  • /partials/ – Shared view snippets like headers, footers, navigation.
  • /default/error/ – Custom error pages (404, 500).
  • /home/ – Main site pages (e.g., welcome.squehub.php).

🧩 /config/ – Configuration Files

  • mail.php – SMTP or mail service configuration.
  • debug.php – Debugging and error reporting settings.

πŸ’Ύ /database/ – Migrations and Seeders

  • /migrations/ – Database schema migration scripts.
  • /dumper/ – Data seeders to populate tables for testing.
  • mg.sql – Optional raw SQL database backup.

🌍 /public/ – Web Root

  • index.php – Front controller entry point.
  • .htaccess – Apache rewrite rules for clean URLs.
  • /assets/ – Public static files: CSS, JavaScript, images.

πŸ“¦ /storage/ – Generated Files

  • /backups/dev/ – Developer backups (zip archives).
  • Future use: Caching, logs, file uploads.

βš™οΈ Root-Level Files

  • .env – Environment variables (database credentials, keys).
  • composer.json – PHP dependencies and autoload configuration.
  • Router.php – Core routing engine.
  • squehub – CLI launcher file.
  • bootstrap.php – Framework bootstrap and initialization.
βœ… Best Practice: Avoid modifying core files in /app/Core/. Instead, extend or override within /project/ to keep your code upgrade-safe.