Repository navigation
Directory Structure
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.
The root directory contains the primary entrypoints, configuration files, and top-level directories for your application.
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 usingphp 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 thedeploycommand and execution hooks.
-
core/Contains the application and API business logic. (Detailed below).
-
public_html/The web-server root. Contains the
index.phpapplication entrypoint and the.htaccessfile 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
deploycommand 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.
-
.dist_archive/Stores versioned snapshots generated by the
deploycommand to enable seamless rollbacks. -
.storage/Maintains file-modification timestamps used by the hot-reloading development engine.
The core/ directory houses the core application logic, settings, and routing configurations.
-
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.
-
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.phpandWeb_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.phpin this directory to manage global scripts, stylesheets, page titles, and favicons. -
utils/Contains shared internal utilities, such as
.envreaders and database wrappers. Custom helpers or application-wide utility classes should be placed here.