Skip to content
Bayram Eker edited this page Jul 13, 2024 · 1 revision

Home

Introduction to Bolt

Welcome to Bolt, the modern PHP framework designed to make web development fast, fun, and efficient. Bolt combines simplicity with powerful features, offering a unique development experience for both beginners and seasoned developers.

Key Features:

  • Modern Architecture: Built on a sleek MVC (Model-View-Controller) structure for clean, maintainable code.
  • Intuitive Routing: Simple yet flexible routing to manage application flow effortlessly.
  • Powerful CLI: Command-line tools to streamline development tasks.
  • Seamless Database Integration: Easy ORM for multiple databases.
  • Elegant Templating: Support for Twig and Blade templates.
  • Middleware Support: Efficient request handling.
  • Authentication and Authorization: Secure user management.
  • Efficient Caching: Speed up your application with built-in caching.
  • Robust Error Handling: Tools for catching and debugging errors.
  • Community and Support: Growing community and extensive documentation.

Quick Start Guide

Follow these steps to get started with Bolt and build your first application:

1. Install Bolt via Composer

To install Bolt, run the following command:

composer create-project bayrameker/my-bolt-framework new-project
cd new-project

2. Set Up Your Environment

Copy the example environment file and configure your settings:

cp .env.example .env

Edit the .env file to match your environment setup.

3. Run the Development Server

Start the server to begin developing your application:

php bolt serve

4. Create Your First Controller

Use the Bolt CLI to create a new controller:

php bolt make:controller HomeController

5. Define Routes and Views

Add routes and create views to build out your application.

Example Route Definition:

// routes/web.php
$router->get('/home', [App\Controllers\HomeController::class, 'index']);

Example Controller:

// app/Controllers/HomeController.php
namespace App\Controllers;

use Core\Controller;

class HomeController extends Controller
{
    public function index()
    {
        return view('home.index', ['message' => 'Welcome to Bolt!']);
    }
}

Example View:

<!-- resources/views/home/index.twig -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{{ title }}</title>
</head>
<body>
    <h1>{{ message }}</h1>
</body>
</html>

Explore Further

Join the Bolt community today and start building the future of web development!