Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FUEL_ENV=development

DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=lefuel
DB_USERNAME=lefuel
DB_PASSWORD=secret
70 changes: 70 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: CI

on:
push:
branches: ["**"]
pull_request:
branches: ["**"]

jobs:
test:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: ["8.1", "8.2", "8.3"]

services:
mysql:
image: mysql:8.0
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: lefuel_test
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5

steps:
- uses: actions/checkout@v4

- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, pdo, pdo_mysql, xml
coverage: none

- name: Cache Composer packages
uses: actions/cache@v4
with:
path: fuel/vendor
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('composer.json') }}
restore-keys: |
${{ runner.os }}-php-${{ matrix.php }}-

- name: Install dependencies
run: composer install --no-scripts --prefer-dist --no-progress

- name: Copy env
run: cp .env.example .env

- name: Run tests
run: |
if [ -d fuel/app/tests ]; then
./fuel/vendor/bin/phpunit --testdox fuel/app/tests
else
echo "No tests found yet — skipping."
fi
env:
FUEL_ENV: test
DB_HOST: 127.0.0.1
DB_PORT: 3306
DB_DATABASE: lefuel_test
DB_USERNAME: root
DB_PASSWORD: root
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ desktop.ini
/composer.lock
/fuel/vendor

# composer binary (use system-installed composer instead)
composer.phar

# environment files
.env

# any of the fuel packages installed by default
/docs/
/fuel/core/
Expand Down
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

93 changes: 93 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# LeFuel Architecture

LeFuel is a fork of FuelPHP 1.8 targeting PHP 8.1+. This document describes every top-level folder and its purpose.

---

## Root

| Path | Purpose |
|------|---------|
| `composer.json` | Dependency manifest. Packages install into `fuel/vendor/` (third-party) and `fuel/core/`, `fuel/packages/*/` (FuelPHP packages). |
| `oil` | CLI entry-point. `php oil <command>` runs generators, migrations, tasks, and the built-in test runner. |
| `Dockerfile` | Single-stage `php:8.3-cli` image that serves the app on port 8000. |
| `docker-compose.yml` | Defines the `app` service (this image) and a `mysql:8.0` service with a persistent named volume. |
| `.env.example` | Template for the `.env` file that each environment copies and fills in. Never committed. |
| `.github/workflows/ci.yml` | GitHub Actions matrix CI — runs PHPUnit against PHP 8.1, 8.2, and 8.3 with a MySQL 8 sidecar. |

---

## `fuel/`

The entire PHP runtime lives here. Only `fuel/app/` is committed; everything else is Composer-installed and git-ignored.

### `fuel/app/`

Application code you write and own.

| Sub-path | Purpose |
|----------|---------|
| `bootstrap.php` | Application bootstrap. Loaded by `public/index.php`; sets the app path and environment, then hands off to the FuelPHP kernel. |
| `classes/controller/` | HTTP controllers. Each file is a class named `Controller_<Name>` extending `Controller` (or a sub-type). Methods prefixed `action_` map to URL segments. |
| `classes/model/` | Data-layer models. Extend `\Orm\Model` for Active Record, or use raw `DB::` calls. |
| `classes/presenter/` | Presenter/ViewModel layer. Sits between controllers and views, keeps logic out of templates. |
| `config/` | Configuration files. `config.php` is the master config; `db.php` holds database DSNs. Sub-folders (`development/`, `production/`, `staging/`, `test/`) override settings per `FUEL_ENV`. `routes.php` maps URL patterns to controller/action pairs. |
| `lang/` | i18n strings, keyed by locale (`en/`, etc.). |
| `logs/` | Runtime log files (git-ignored below day level). |
| `cache/` | File-based cache output (git-ignored). |
| `migrations/` | Numbered migration files run via `php oil r migrate`. |
| `modules/` | Self-contained feature modules. Each module mirrors the `app/` structure and is loaded on demand. |
| `tasks/` | CLI task classes run via `php oil r <task>`. `robots.php` is the bundled example. |
| `tests/` | PHPUnit test suites mirroring `classes/` (controller, model, presenter, view sub-directories). |
| `themes/` | Theme asset sets for the Theme package (optional). |
| `tmp/` | Transient working files (e.g. upload staging). Git-ignored. |
| `vendor/` | App-level Composer packages (distinct from `fuel/vendor/`). Rarely used directly. |
| `views/` | PHP view templates. Organised as `views/<controller>/<action>.php`. |

### `fuel/core/` *(git-ignored, Composer-installed)*

The FuelPHP kernel: autoloader, base classes, Input, Output, Request, Response, Session, Security, and all core helpers. Installed to `fuel/core/` via the `composer/installers` path rule.

### `fuel/packages/` *(git-ignored, Composer-installed)*

Optional first-party packages installed alongside core:

| Package | Purpose |
|---------|---------|
| `auth/` | Authentication (login, ACL, hashing). |
| `email/` | Email sending abstraction. |
| `oil/` | CLI tool internals (generators, scaffolding). |
| `orm/` | Object-Relational Mapper (Active Record pattern). |
| `parser/` | Template engine bridge (Twig, Smarty, Mustache, etc.). |

### `fuel/vendor/` *(git-ignored, Composer-installed)*

All Composer third-party dependencies (e.g. `phpunit/phpunit`, `fuelphp/upload`). Managed entirely by Composer; never edit manually.

---

## `public/`

The web root. Point your web server's `document_root` here.

| Sub-path | Purpose |
|----------|---------|
| `index.php` | Front controller. Sets `DOCROOT`, loads `fuel/app/bootstrap.php`, and dispatches the request. |
| `.htaccess` | Apache rewrite rules that funnel all requests to `index.php`. |
| `web.config` | IIS equivalent of `.htaccess`. |
| `assets/` | Static assets served directly: Bootstrap CSS/JS and Glyphicon fonts. Organised as `assets/{css,js,fonts,img}/`. |
| `favicon.ico` | Default favicon. |

---

## Request Lifecycle (summary)

```
Browser → public/index.php
→ fuel/app/bootstrap.php (env, paths)
→ fuel/core (Request/Router)
→ fuel/app/config/routes.php
→ Controller_<Name>::action_<name>()
→ View::forge('folder/template')
→ Response → Browser
```
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM php:8.3-cli

RUN apt-get update && apt-get install -y \
git \
unzip \
libzip-dev \
libonig-dev \
libxml2-dev \
&& docker-php-ext-install pdo pdo_mysql mbstring zip xml \
&& rm -rf /var/lib/apt/lists/*

COPY --from=composer:2 /usr/bin/composer /usr/bin/composer

WORKDIR /app

COPY composer.json ./
RUN composer install --no-scripts --prefer-dist --no-progress

COPY . .

EXPOSE 8000

CMD ["php", "-S", "0.0.0.0:8000", "public/index.php"]
12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "fuel/fuel",
"name": "leborn-dev/lefuel",
"type": "project",
"description" : "FuelPHP is a simple, flexible, community driven PHP 5.4+ framework, based on the best ideas of other frameworks, with a fresh start!",
"keywords": ["application", "website", "development", "framework", "PHP", "PHP7"],
"license": "MIT",
"require": {
"php": ">=5.4",
"php": ">=8.1",
"composer/installers": "~1.0",
"fuel/core": "1.8.*",
"fuel/auth": "1.8.*",
Expand All @@ -16,7 +16,8 @@
"fuelphp/upload": "2.0.6"
},
"require-dev": {
"fuel/docs": "1.8.*"
"fuel/docs": "1.8.*",
"phpunit/phpunit": "^10.0"
},
"suggest": {
"dwoo/dwoo" : "Allow Dwoo templating with the Parser package",
Expand All @@ -28,7 +29,10 @@
"zordius/lightncandy": "Allow Handlebars templating with an extremely fast PHP implementation of handlebars"
},
"config": {
"vendor-dir": "fuel/vendor"
"vendor-dir": "fuel/vendor",
"allow-plugins": {
"composer/installers": true
}
},
"extra": {
"installer-paths": {
Expand Down
Binary file removed composer.phar
Binary file not shown.
37 changes: 37 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
services:
app:
build: .
ports:
- "8000:8000"
environment:
FUEL_ENV: development
DB_HOST: mysql
DB_PORT: 3306
DB_DATABASE: lefuel
DB_USERNAME: lefuel
DB_PASSWORD: secret
volumes:
- .:/app
depends_on:
mysql:
condition: service_healthy

mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: rootsecret
MYSQL_DATABASE: lefuel
MYSQL_USER: lefuel
MYSQL_PASSWORD: secret
ports:
- "3306:3306"
volumes:
- mysql_data:/var/lib/mysql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 10s
timeout: 5s
retries: 5

volumes:
mysql_data:
9 changes: 9 additions & 0 deletions fuel/app/classes/controller/hello.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

class Controller_Hello extends Controller
{
public function action_index()
{
return Response::forge(View::forge('hello/index'));
}
}
8 changes: 8 additions & 0 deletions fuel/app/config/asset.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
/**
* Use DOCROOT-relative absolute paths so assets resolve correctly regardless
* of the PHP process working directory (e.g. php -S from the project root).
*/
return array(
'paths' => array(DOCROOT.'assets/'),
);
2 changes: 2 additions & 0 deletions fuel/app/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@
*/

'hello(/:name)?' => array('welcome/hello', 'name' => 'hello'),

'helloworld' => 'hello/index',
);
12 changes: 12 additions & 0 deletions fuel/app/views/hello/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello World - LeFuel</title>
</head>
<body>
<h1>Hello World!</h1>
<p>Welcome to LeFuel.</p>
</body>
</html>
25 changes: 25 additions & 0 deletions router.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* PHP built-in server router for FuelPHP.
*
* Usage: php -S localhost:8000 router.php
*
* Without -t, PHP sets SCRIPT_NAME = REQUEST_URI which confuses FuelPHP's
* URI detector. This router fixes SCRIPT_NAME and also handles static asset
* serving from public/ so the built-in server acts like a real web server.
*/

$uri = urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));

// Serve real static files from public/ (assets, favicon, etc.)
$public = __DIR__ . '/public';
if ($uri !== '/' && file_exists($public . $uri) && !is_dir($public . $uri)) {
return false; // let the built-in server serve it directly
}

// Fix SCRIPT_NAME so FuelPHP URI detection works correctly
$_SERVER['SCRIPT_NAME'] = '/index.php';

// Run through FuelPHP's front controller
chdir($public);
require $public . '/index.php';
Loading