
Show HN: Mouse-PHP a Minimalist PHP Framework with Good DX for Spas
mouse-php is a lightweight, zero-dependency PHP framework designed to deliver an exceptional developer experience without the overhead of magic obfuscation. It strikes the perfect balance between robust tooling and arch…
以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。
mouse-php is a lightweight, zero-dependency PHP framework designed to deliver an exceptional developer experience without the overhead of magic obfuscation. It strikes the perfect balance between robust tooling and architectural transparency, allowing you to build web applications and RESTful APIs quickly while maintaining full visibility into your code structure.
Production-Ready Out of the Box: Zero boilerplate configuration required. Install, initialize, and start writing your business logic immediately.
Easy to learn: Built on standard PHP syntax and clean OOP principles—no complex abstraction layers to learn.
Lightning-Fast Deployments: Features a built-in deploy command via squeak to generate lightweight, distribution-ready application packages in seconds, complete with version rollback support.
Robust CLI Tooling (squeak): Includes a powerful companion CLI utility handling scaffolding, routing management, middleware registration, and application bootstrapping.
Eliminating the "F5" Fatigue
A standout feature of the mouse-php ecosystem is its integrated development server, which automatically reloads your application upon code changes. Initiated via squeak serve, this brings the rapid, hot-reloading iteration workflow popularized by the JS/Vite ecosystem directly to PHP development.
- Prerequisites
PHP 8.3+
Extensions: PDO, sqlite3, php-sqlite3, php-pdo-sqlite
Database: MariaDB or MySQL
Web Server: A CGI-compatible web server like Apache or NGINX (Recommended for production, not required for local development)
- Database Set Up
Install and configure your preferred database server (MariaDB/MySQL or SQLite).
Create a dedicated database and user for your application.
Retain these credentials for the configuration wizard in step 4.
Now that you have all the prerequisites installed and set up you can start building your first application.There are two ways to get started:
Before bootstrapping a project, ensure Composer is installed globally on your system and that its global binary directory is present in your shell PATH.
If you do not already have Composer installed globally, run the installer script to place the binary into /usr/local/bin:
Download and execute the official Composer installer
curl -sS https://getcomposer.org/installer | php
Move the executable to your global path
sudo mv composer.phar /usr/local/bin/composer
Next, ensure Composer's global vendor binary directory is added to your environment PATH (typically ~/.config/composer/vendor/bin on Linux or ~/.composer/vendor/bin):
Add this line to your ~/.bashrc or ~/.zshrc file:
export PATH="$(composer config -g home)/vendor/bin:$PATH"
Apply the changes
source ~/.bashrc
- Installing create-mouse-app
Install the CLI tool globally using Composer:
composer global require mouse-php/create-mouse-app
- Bootstrapping a New Project
Run create-mouse-app followed by your desired project directory name. This command leverages Squeak's initialization engine to scaffold your directory structure, create an .env file, and generate authentication code if your database configuration is set up:
create-mouse-app my-app
- Post-Initialization Setup
Once the scaffolding script finishes running, move into your new project directory and launch the local development server. Launch the squeak CLI Shell to bootstrap your project:
php squeak
Start the hot-reloading development server by running the following command inside the squeak shell:
If you see the default welcome page shown below, you are ready to start developing!
git clone https://github.com/drawfig/mouse-php.git cd mouse-php
Alternatively, download the compiled archive from the Releases Page.
Launch the 'squeak' CLI tool to bootstrap your environment:
php squeak
inside the interactive CLI shell, run the initialization command:
Start the hot-reloading development environment:
You should now be able to see the default welcome page, if so Congratulations! You've successfully installed and configured mouse-php and can begin developing your application.
mouse-php is an open-source project, and we welcome contributions from the community! If you'd like to get involved, here are a few ways you can help:
Your contributions are greatly appreciated and help make mouse-php better for everyone.
mouse-php is open-source software licensed under the Apache-2.0 License. A copy of the license is included in the root directory of this project.
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。