Skip to content

Commit 1f866b7

Browse files
committed
add analysis fixes, PHP 8.x fixes, create hello world pages
1 parent a9e44ab commit 1f866b7

14 files changed

Lines changed: 300 additions & 16 deletions

File tree

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FUEL_ENV=development
2+
3+
DB_HOST=127.0.0.1
4+
DB_PORT=3306
5+
DB_DATABASE=lefuel
6+
DB_USERNAME=lefuel
7+
DB_PASSWORD=secret

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
branches: ["**"]
8+
9+
jobs:
10+
test:
11+
name: PHP ${{ matrix.php }}
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
php: ["8.1", "8.2", "8.3"]
18+
19+
services:
20+
mysql:
21+
image: mysql:8.0
22+
env:
23+
MYSQL_ROOT_PASSWORD: root
24+
MYSQL_DATABASE: lefuel_test
25+
ports:
26+
- 3306:3306
27+
options: >-
28+
--health-cmd="mysqladmin ping"
29+
--health-interval=10s
30+
--health-timeout=5s
31+
--health-retries=5
32+
33+
steps:
34+
- uses: actions/checkout@v4
35+
36+
- name: Set up PHP ${{ matrix.php }}
37+
uses: shivammathur/setup-php@v2
38+
with:
39+
php-version: ${{ matrix.php }}
40+
extensions: mbstring, pdo, pdo_mysql, xml
41+
coverage: none
42+
43+
- name: Cache Composer packages
44+
uses: actions/cache@v4
45+
with:
46+
path: fuel/vendor
47+
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('composer.json') }}
48+
restore-keys: |
49+
${{ runner.os }}-php-${{ matrix.php }}-
50+
51+
- name: Install dependencies
52+
run: composer install --no-scripts --prefer-dist --no-progress
53+
54+
- name: Copy env
55+
run: cp .env.example .env
56+
57+
- name: Run tests
58+
run: |
59+
if [ -d fuel/app/tests ]; then
60+
./fuel/vendor/bin/phpunit --testdox fuel/app/tests
61+
else
62+
echo "No tests found yet — skipping."
63+
fi
64+
env:
65+
FUEL_ENV: test
66+
DB_HOST: 127.0.0.1
67+
DB_PORT: 3306
68+
DB_DATABASE: lefuel_test
69+
DB_USERNAME: root
70+
DB_PASSWORD: root

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ desktop.ini
1818
/composer.lock
1919
/fuel/vendor
2020

21+
# composer binary (use system-installed composer instead)
22+
composer.phar
23+
24+
# environment files
25+
.env
26+
2127
# any of the fuel packages installed by default
2228
/docs/
2329
/fuel/core/

.travis.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

ARCHITECTURE.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# LeFuel Architecture
2+
3+
LeFuel is a fork of FuelPHP 1.8 targeting PHP 8.1+. This document describes every top-level folder and its purpose.
4+
5+
---
6+
7+
## Root
8+
9+
| Path | Purpose |
10+
|------|---------|
11+
| `composer.json` | Dependency manifest. Packages install into `fuel/vendor/` (third-party) and `fuel/core/`, `fuel/packages/*/` (FuelPHP packages). |
12+
| `oil` | CLI entry-point. `php oil <command>` runs generators, migrations, tasks, and the built-in test runner. |
13+
| `Dockerfile` | Single-stage `php:8.3-cli` image that serves the app on port 8000. |
14+
| `docker-compose.yml` | Defines the `app` service (this image) and a `mysql:8.0` service with a persistent named volume. |
15+
| `.env.example` | Template for the `.env` file that each environment copies and fills in. Never committed. |
16+
| `.github/workflows/ci.yml` | GitHub Actions matrix CI — runs PHPUnit against PHP 8.1, 8.2, and 8.3 with a MySQL 8 sidecar. |
17+
18+
---
19+
20+
## `fuel/`
21+
22+
The entire PHP runtime lives here. Only `fuel/app/` is committed; everything else is Composer-installed and git-ignored.
23+
24+
### `fuel/app/`
25+
26+
Application code you write and own.
27+
28+
| Sub-path | Purpose |
29+
|----------|---------|
30+
| `bootstrap.php` | Application bootstrap. Loaded by `public/index.php`; sets the app path and environment, then hands off to the FuelPHP kernel. |
31+
| `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. |
32+
| `classes/model/` | Data-layer models. Extend `\Orm\Model` for Active Record, or use raw `DB::` calls. |
33+
| `classes/presenter/` | Presenter/ViewModel layer. Sits between controllers and views, keeps logic out of templates. |
34+
| `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. |
35+
| `lang/` | i18n strings, keyed by locale (`en/`, etc.). |
36+
| `logs/` | Runtime log files (git-ignored below day level). |
37+
| `cache/` | File-based cache output (git-ignored). |
38+
| `migrations/` | Numbered migration files run via `php oil r migrate`. |
39+
| `modules/` | Self-contained feature modules. Each module mirrors the `app/` structure and is loaded on demand. |
40+
| `tasks/` | CLI task classes run via `php oil r <task>`. `robots.php` is the bundled example. |
41+
| `tests/` | PHPUnit test suites mirroring `classes/` (controller, model, presenter, view sub-directories). |
42+
| `themes/` | Theme asset sets for the Theme package (optional). |
43+
| `tmp/` | Transient working files (e.g. upload staging). Git-ignored. |
44+
| `vendor/` | App-level Composer packages (distinct from `fuel/vendor/`). Rarely used directly. |
45+
| `views/` | PHP view templates. Organised as `views/<controller>/<action>.php`. |
46+
47+
### `fuel/core/` *(git-ignored, Composer-installed)*
48+
49+
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.
50+
51+
### `fuel/packages/` *(git-ignored, Composer-installed)*
52+
53+
Optional first-party packages installed alongside core:
54+
55+
| Package | Purpose |
56+
|---------|---------|
57+
| `auth/` | Authentication (login, ACL, hashing). |
58+
| `email/` | Email sending abstraction. |
59+
| `oil/` | CLI tool internals (generators, scaffolding). |
60+
| `orm/` | Object-Relational Mapper (Active Record pattern). |
61+
| `parser/` | Template engine bridge (Twig, Smarty, Mustache, etc.). |
62+
63+
### `fuel/vendor/` *(git-ignored, Composer-installed)*
64+
65+
All Composer third-party dependencies (e.g. `phpunit/phpunit`, `fuelphp/upload`). Managed entirely by Composer; never edit manually.
66+
67+
---
68+
69+
## `public/`
70+
71+
The web root. Point your web server's `document_root` here.
72+
73+
| Sub-path | Purpose |
74+
|----------|---------|
75+
| `index.php` | Front controller. Sets `DOCROOT`, loads `fuel/app/bootstrap.php`, and dispatches the request. |
76+
| `.htaccess` | Apache rewrite rules that funnel all requests to `index.php`. |
77+
| `web.config` | IIS equivalent of `.htaccess`. |
78+
| `assets/` | Static assets served directly: Bootstrap CSS/JS and Glyphicon fonts. Organised as `assets/{css,js,fonts,img}/`. |
79+
| `favicon.ico` | Default favicon. |
80+
81+
---
82+
83+
## Request Lifecycle (summary)
84+
85+
```
86+
Browser → public/index.php
87+
→ fuel/app/bootstrap.php (env, paths)
88+
→ fuel/core (Request/Router)
89+
→ fuel/app/config/routes.php
90+
→ Controller_<Name>::action_<name>()
91+
→ View::forge('folder/template')
92+
→ Response → Browser
93+
```

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM php:8.3-cli
2+
3+
RUN apt-get update && apt-get install -y \
4+
git \
5+
unzip \
6+
libzip-dev \
7+
libonig-dev \
8+
libxml2-dev \
9+
&& docker-php-ext-install pdo pdo_mysql mbstring zip xml \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
13+
14+
WORKDIR /app
15+
16+
COPY composer.json ./
17+
RUN composer install --no-scripts --prefer-dist --no-progress
18+
19+
COPY . .
20+
21+
EXPOSE 8000
22+
23+
CMD ["php", "-S", "0.0.0.0:8000", "public/index.php"]

composer.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"name": "fuel/fuel",
2+
"name": "leborn-dev/lefuel",
33
"type": "project",
44
"description" : "FuelPHP is a simple, flexible, community driven PHP 5.4+ framework, based on the best ideas of other frameworks, with a fresh start!",
55
"keywords": ["application", "website", "development", "framework", "PHP", "PHP7"],
66
"license": "MIT",
77
"require": {
8-
"php": ">=5.4",
8+
"php": ">=8.1",
99
"composer/installers": "~1.0",
1010
"fuel/core": "1.8.*",
1111
"fuel/auth": "1.8.*",
@@ -16,7 +16,8 @@
1616
"fuelphp/upload": "2.0.6"
1717
},
1818
"require-dev": {
19-
"fuel/docs": "1.8.*"
19+
"fuel/docs": "1.8.*",
20+
"phpunit/phpunit": "^10.0"
2021
},
2122
"suggest": {
2223
"dwoo/dwoo" : "Allow Dwoo templating with the Parser package",
@@ -28,7 +29,10 @@
2829
"zordius/lightncandy": "Allow Handlebars templating with an extremely fast PHP implementation of handlebars"
2930
},
3031
"config": {
31-
"vendor-dir": "fuel/vendor"
32+
"vendor-dir": "fuel/vendor",
33+
"allow-plugins": {
34+
"composer/installers": true
35+
}
3236
},
3337
"extra": {
3438
"installer-paths": {

composer.phar

-1.76 MB
Binary file not shown.

docker-compose.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
services:
2+
app:
3+
build: .
4+
ports:
5+
- "8000:8000"
6+
environment:
7+
FUEL_ENV: development
8+
DB_HOST: mysql
9+
DB_PORT: 3306
10+
DB_DATABASE: lefuel
11+
DB_USERNAME: lefuel
12+
DB_PASSWORD: secret
13+
volumes:
14+
- .:/app
15+
depends_on:
16+
mysql:
17+
condition: service_healthy
18+
19+
mysql:
20+
image: mysql:8.0
21+
environment:
22+
MYSQL_ROOT_PASSWORD: rootsecret
23+
MYSQL_DATABASE: lefuel
24+
MYSQL_USER: lefuel
25+
MYSQL_PASSWORD: secret
26+
ports:
27+
- "3306:3306"
28+
volumes:
29+
- mysql_data:/var/lib/mysql
30+
healthcheck:
31+
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
32+
interval: 10s
33+
timeout: 5s
34+
retries: 5
35+
36+
volumes:
37+
mysql_data:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
class Controller_Hello extends Controller
4+
{
5+
public function action_index()
6+
{
7+
return Response::forge(View::forge('hello/index'));
8+
}
9+
}

0 commit comments

Comments
 (0)