A lightning-fast PHP micro-framework, modernized for PHP 8.3+
Originally created in 2014-2015, Tipsy has been completely modernized while maintaining its core philosophy: "Small and Fast, but Highly Flexible".
14.77x Performance Improvement over legacy PHP 5.6 version:
- Legacy (PHP 5.6): 167.46 req/sec
- NextGen (PHP 8.3): 2,474.34 req/sec
# Start the modernized framework demo
./demo.sh
# Or check status first
./status.sh
Demo will be available at: http://localhost:8080
- Main Demo: http://localhost:8080/ (Interactive showcase)
- JSON API: http://localhost:8080/api/test (Framework info)
- User Route: http://localhost:8080/user/123 (Dynamic parameters)
- Collections: http://localhost:8080/looper/demo (Looper demonstration)
- Dependency Injection: http://localhost:8080/injection/demo (Auto-injection)
# Run full performance comparison
./real_comparison.sh
- PHP 8.3+ Required - Modern type system, match expressions, attributes
- Strict Types -
declare(strict_types=1)
in all files - Performance Optimized - Critical path optimizations, zero legacy code
- Type Safety - Complete return types, union types, nullable types
- β No more
call_user_func_array()
- β No more PHP 5.x compatibility hacks
- β No more error suppression
@
- β No more outdated function polyfills
- Match Expressions - Replace legacy switch statements
- String Functions -
str_starts_with()
,str_contains()
- Spread Operators -
...$args
for function calls - Constructor Property Promotion - Where applicable
- Union Types -
string|int
,callable|string
- App.php - Service container with type safety
- Router.php - Performance-optimized routing
- Route.php - Individual route matching (critical path optimized)
- DependencyInjector.php - Modern reflection-based injection
- Request.php - HTTP request handling with match expressions
- View.php - Template engine with layout support
- Resource.php - Active Record ORM with multi-database support
- Looper.php - Collection processing with jQuery-like interface
<?php
require 'vendor/autoload.php';
use Tipsy\Tipsy;
$app = new Tipsy();
$app->get('/', function($Request, $View) {
$View->display('home', ['message' => 'Hello Tipsy v2.0!']);
});
$app->get('/api/users/:id', function($Params, $Response) {
$user = ['id' => $Params->id, 'name' => 'John Doe'];
$Response->json($user);
});
$app->run();
// Define a User resource
$app->service('User', [
'_table' => 'users',
'_id' => 'id'
]);
// Active Record operations
$user = User::o(1); // Load by ID
$user->name = 'Updated Name';
$user->save(); // Save changes
// Query with Looper collections
$admins = User::q('SELECT * FROM users WHERE role = ?', ['admin']);
$admins->each(function() {
echo $this->name . "\n";
});
$users = new Looper([
(object)['name' => 'John', 'role' => 'admin'],
(object)['name' => 'Jane', 'role' => 'user'],
]);
$admins = $users->filter(['role' => 'admin']);
echo $admins->json(); // JSON output
cd nextgen/baseline
docker-compose up -d
# Available at http://localhost:8080
cd legacy/baseline
docker-compose up -d
# Available at http://localhost:8081
tipsy/
βββ README.md # This file
βββ demo.sh # Quick demo script (./demo.sh)
βββ status.sh # Check system status (./status.sh)
βββ real_comparison.sh # Performance comparison
βββ nextgen/ # Modernized PHP 8.3+ version
β βββ src/ # Framework source code (21 modernized files)
β βββ baseline/ # Docker demo environment
β βββ composer.json # Modern dependencies
βββ legacy/ # Original PHP 5.6 version
βββ src/ # Legacy source code
βββ baseline/ # Legacy Docker environment
Tipsy maintains its original philosophy while embracing modern PHP:
- Small - Minimal dependencies, lightweight core
- Fast - Performance-first design, optimized critical paths
- Flexible - Convention over configuration, but configurable
- Modern - PHP 8.3+ features, strict types, zero legacy code
- PHP 8.3+ (Required)
- Docker (For demo environment)
- Composer (For autoloading)
Run ./real_comparison.sh
to see the dramatic performance improvements:
Legacy (PHP 5.6): 167.46 req/sec, 47.91ms latency
NextGen (PHP 8.3): 2474.34 req/sec, 3.24ms latency
Improvement: 14.77x faster
This is a modernization project showcasing how legacy PHP frameworks can be brought into the modern era while maintaining their core strengths.
MIT License - Same as original Tipsy framework
Tipsy v2.0 - Proving that legacy frameworks can be modernized for dramatic performance gains while maintaining their essential character.