PHPackages                             webdernargor/thungthao - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. webdernargor/thungthao

ActiveProject[Utility &amp; Helpers](/categories/utility)

webdernargor/thungthao
======================

PHP page layout components system clone form nuxt starter code

1.0.7(5mo ago)06PHPPHP &gt;=7.0

Since Dec 19Pushed 3mo agoCompare

[ Source](https://github.com/WEBDERNargor/thungthao)[ Packagist](https://packagist.org/packages/webdernargor/thungthao)[ RSS](/packages/webdernargor-thungthao/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Thungthao
=========

[](#thungthao)

Pages layouts components system by PHP starter code.

starter with layouts, pages (file-based routing), components, controllers, composables, API, and global hooks.

Features
--------

[](#features)

- **Layouts**: Define page shells in `layouts/` and switch with `$layout->setLayout('default')`.
- **File-based Routing**: Files in `pages/` map to URLs. Dynamic params via `[param]`, folder `index.php` supported.
- **Components**: Reusable UI from `components/` included in layouts/pages.
- **Controllers**: PSR-4 autoloaded under `App\\Controllers\\`.
- **Composables**: Utilities in `composables/` that return callable arrays.
- **API**: JSON endpoints in `api/` (directly accessible as `/api/*.php`).
- **Global**: `global.php` runs on every request.
- **Styling**: TailwindCSS + jQuery via CDN in layout.
- **Docs**: Built-in documentation at `/docs` (navbar, sidebar, search).

Documentation
-------------

[](#documentation)

- Online:

Requirements
------------

[](#requirements)

- PHP &gt;= 7.0
- Composer
- Web server (Apache/Nginx) or PHP built-in server
- For Apache, enable rewrite and use the provided `.htaccess`

Quick Start
-----------

[](#quick-start)

```
# create a new project
composer create-project webdernargor/thungthao

# copy environment template
cp example.env .env   # Windows PowerShell: Copy-Item example.env .env

# start the dev server (uses serve.php)
composer web
```

Open the URL configured in `.env` (`WEB_URL`) or as printed by the dev server.

Configuration (.env)
--------------------

[](#configuration-env)

Key variables consumed by `config.php`:

- `WEB_MODE` (e.g. `development`)
- `WEB_URL` (e.g. `http://127.0.0.1:5000`)
- `WEB_NAME`
- `JWT_SECRET`
- `DB_DRIVER` (`mysql` | `sqlite` | `none`)
- MySQL: `MYSQL_HOST`, `MYSQL_DATABASE`, `MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_PORT`, `MYSQL_CHARSET`
- SQLite: `SQLITE_PATH`

Directory Structure
-------------------

[](#directory-structure)

```
.
├─ api/                # JSON endpoints
├─ components/         # UI components
├─ composables/        # Reusable utilities (return arrays of functions)
├─ controllers/        # App\\Controllers classes
├─ includes/           # Core (internal) — avoid editing
├─ layouts/            # Page shells
├─ pages/              # File-based routes
├─ public/             # Public assets (e.g., js/docs-search.js)
├─ config.php          # Loads .env and builds config array
├─ global.php          # Runs on every request
├─ index.php           # Entry point
└─ serve.php           # Dev server helper

```

Usage Examples
--------------

[](#usage-examples)

### Set head in a page

[](#set-head-in-a-page)

```

```

### Switch layout for a page

[](#switch-layout-for-a-page)

```
