A powerful, secure, and developer-friendly PHP framework that goes beyond Laravel.
Titan is a modern PHP framework designed to be more powerful, more secure, and easier to use than Laravel. It follows modern PHP practices, is fully PSR compliant, and provides a clean, elegant syntax for building web applications.
- Ultra-fast Performance: Optimized core with minimal overhead
- Advanced Dependency Injection: Powerful container with automatic resolution
- Enhanced Security: Built with security-first principles
- Elegant Routing: Intuitive and flexible router
- Modern Architecture: Follows PHP 8.2+ features and best practices
- Comprehensive ORM: Simple yet powerful database abstraction
- PSR Compliance: Follows PHP Standards Recommendations
- Clean Code Structure: Well-organized, maintainable code
- Robust Request/Response: Advanced HTTP handling
- Powerful CLI Tools: Feature-rich console commands
- Comprehensive Documentation: Easy to learn and use
- Highly Extensible: Easy to add or customize functionality
- PHP 8.2 or higher
- PHP extensions:
- PDO
- JSON
- mbstring
- Fileinfo
composer create-project titan/titan your-project-name
- Clone the repository:
git clone https://github.com/titan/framework.git your-project-name
- Install dependencies:
cd your-project-name
composer install
- Copy
.env.example
to.env
and configure your environment:
cp .env.example .env
- Generate an application key:
php titan key:generate
In routes/web.php
:
use Titan\Core\Facades\Route;
Route::get('/hello/{name}', function ($name) {
return "Hello, $name!";
});
php titan make:controller HelloController
Edit app/Controllers/HelloController.php
:
namespace App\Controllers;
use Titan\Http\Request;
use Titan\Http\Response;
class HelloController extends Controller
{
public function index(Request $request): Response
{
return $this->view('hello', [
'name' => $request->route('name', 'World')
]);
}
}
Then update your route:
Route::get('/hello/{name}', 'HelloController@index');
php titan make:model Post
Edit app/Models/Post.php
:
namespace App\Models;
class Post extends Model
{
protected string $table = 'posts';
protected array $fillable = [
'title',
'content',
'published'
];
}
app/
├── Controllers/ # Application controllers
├── Models/ # Data models
├── Middleware/ # HTTP middleware
├── Providers/ # Service providers
├── Services/ # Business logic services
bootstrap/ # Application bootstrapping files
config/ # Configuration files
database/
├── migrations/ # Database migrations
├── seeds/ # Database seeders
├── factories/ # Model factories
public/ # Publicly accessible files
resources/
├── views/ # View templates
├── assets/ # Uncompiled assets
routes/ # Route definitions
storage/ # Application generated files
tests/ # Automated tests
Titan uses environment-based configuration. The main configuration files are stored in the config/
directory and use environment variables defined in the .env
file.
app.php
: Application configurationdatabase.php
: Database configurationcache.php
: Cache configurationlogging.php
: Logging configuration
Titan is built with a security-first mindset. It includes:
- CSRF protection
- XSS prevention
- SQL injection protection
- Authentication system with password hashing
- Authorization system with roles and permissions
- Input validation
- Rate limiting
- Secure headers
For complete documentation, visit https://titan-framework.com/docs.
Contributions are welcome! Please see CONTRIBUTING.md for more information.
The Titan framework is open-source software licensed under the MIT license.