Skip to content

Directory Structure

drawfig edited this page Aug 13, 2026 · 3 revisions

The default directory layout of mouse-php is designed to keep your application’s logic clean, readable, and easy to maintain. While you are free to customize this structure as long as your classes can be loaded, this layout is provided as a sane, production-ready default.

Root Directory

The root directory contains the primary entrypoints, configuration files, and top-level directories for your application.

Core Files

Upon initializing a project, you will find the following core files in your root directory:

  • Composer Management (composer.json, composer.lock, composer.phar): Pre-configured to install essential dependencies on initialization and simplify adding third-party packages to your project.
  • Squeak CLI (squeak): The primary entrypoint for the Squeak CLI tools. Execute it from your project root using php squeak.
  • Method Checker (method_checker.php): A utility dependency used internally by the application framework.
  • Local Database (mouse.db): Automatically generated post-initialization to power internal framework features such as rate limiting and request logging.
  • Deployment Config (.deploy.env): Created if selected during initialization to instruct Squeak on how to handle the deploy command and execution hooks.

Root Directories

  • core/

    Contains the application and API business logic. (Detailed below).

  • public_html/

    The web-server root. Contains the index.php application entrypoint and the .htaccess file for server routing/CGI handling. Public static assets such as images, CSS, and JavaScript files should also be placed here.

  • squeak_util/

    Houses internal logic and dependencies for the interactive Squeak shell. Developers typically do not need to modify files in this directory.

  • dist/

    Generated automatically when running the deploy command via Squeak. This contains a compiled, production-ready version of your application with development tooling removed. It is recommended to leave this directory intact so Squeak can archive previous builds during subsequent deployments.

Hidden Utility Directories

  • .dist_archive/

    Stores versioned snapshots generated by the deploy command to enable seamless rollbacks.

  • .storage/

    Maintains file-modification timestamps used by the hot-reloading development engine.

Core Directory

The core/ directory houses the core application logic, settings, and routing configurations.

Core Configuration Files

  • Mouse_Core.php: The main engine class for mouse-php, handling core application initialization and execution.
  • .env.*: Environment-specific configuration files corresponding to your active environment.
  • .env.db_config: Credentials and connection options required to establish database connections.

Subdirectories & Modules

  • controllers/

    The designated directory for all application controller classes.

  • models/

    The designated directory for all application model classes.

  • routes/

    Contains array-based route definition files, separating concerns between Api_Routes.php and Web_Routes.php.

  • middleware/

    Contains the core middleware engine files and configuration settings. Subdirectory middleware/modules/ holds the individual middleware components and logic.

  • display_pages/

    Contains error pages and standard view templates. While mouse-php is an API-first framework, it includes a lightweight view engine that renders template files stored here.

  • page_engine/

    Houses internal view rendering engines. Developers primarily interact with View_Configs.php in this directory to manage global scripts, stylesheets, page titles, and favicons.

  • utils/

    Contains shared internal utilities, such as .env readers and database wrappers. Custom helpers or application-wide utility classes should be placed here.

Clone this wiki locally