A simple, modern PHP framework inspired by Laravel. Pickles provides a clean structure for building web applications, including routing, controllers, models, migrations, validation, session management, and a view engine.
- MVC Structure: Organize your code with Models, Views, and Controllers.
- Routing: Define routes for your application with support for middleware.
- Database ORM: Simple model system with fillable/hidden attributes and query helpers.
- Migrations: Create, run, and rollback database migrations via CLI.
- Validation: Powerful validation rules and custom error messages.
- Session Management: Flash data, session storage abstraction.
- View Engine: Lightweight PHP-based templating.
- Service Providers: Register and configure services for your app.
- Extensible: Easily add your own providers, middleware, and helpers.
- PHP 8.1 or higher
- Composer
- PDO extension (for database access)
- Supported databases: MySQL, PostgreSQL
-
Clone the repository:
git clone https://github.com/gfmois/pickles-framework-1.git cd pickles-framework-1
-
Install dependencies:
composer install
-
Copy and edit your environment file:
cp .env.example .env # Edit .env to match your database and app settings
-
Set up git hooks (optional):
chmod +x setup-git.sh ./setup-git.sh
All configuration files are in the config/
directory:
app.php
: App name, environment, URL, version.database.php
: Database connection settings.session.php
: Session storage driver.view.php
: View engine and path.providers.php
: Service providers for boot/runtime/CLI.
You can use environment variables in your .env
file to override config values.
Start the built-in PHP server from the public/
directory:
php -S localhost:8080 -t public
Visit http://localhost:8080 in your browser.
Define routes in routes/web.php
or directly in your entry file:
use Pickles\Http\Request;
use Pickles\Routing\Route;
Route::GET('/hello', function(Request $request) {
return 'Hello, Pickles!';
});
Create controllers in app/Controllers/
and models in app/Models/
. Example model:
class User extends Model {
public array $fillable = ['name', 'email'];
}
php pickles.php make:migration create_users_table
Edit the generated file in database/migrations/
.
php pickles.php migrate
php pickles.php migration:rollback [steps]
- Omit
[steps]
to rollback all, or provide a number to rollback N migrations.
Use validation rules in your controllers or route handlers:
$data = $request->validate([
'email' => 'required|email',
'password' => 'required|min:8',
]);
Run the test suite with PHPUnit:
composer test
Tests are located in the tests/
directory.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/your-feature
). - Commit your changes.
- Push to the branch (
git push origin feature/your-feature
). - Open a pull request.
This project is licensed under the MIT License.
Moisés Guerola
Contact
chmod -x setup-git.sh
./setup-git.sh
chmod +x .githooks/pre-commit
git config core.hooksPath .githooks