PHPackages                             robertkleinschuster/zenith - 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. [Framework](/categories/framework)
4. /
5. robertkleinschuster/zenith

ActiveLibrary[Framework](/categories/framework)

robertkleinschuster/zenith
==========================

A Component App Framework for PHP

v0.0.1(2y ago)0481MITPHPPHP ^8.2

Since Mar 8Pushed 2y ago1 watchersCompare

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

READMEChangelogDependencies (6)Versions (2)Used By (1)

Zenith
======

[](#zenith)

**Zenith** is an advanced PHP application framework designed to streamline the development process by incorporating both the [Slim Framework](https://www.slimframework.com) and [Compass Router](https://github.com/robertkleinschuster/compass) for a component-driven development experience inspired by NEXT.js routing.

Key Features
------------

[](#key-features)

- **Component-Driven Development:** Utilizes a highly modular architecture allowing for reusable components.
- **NEXT.js Inspired Routing:** Offers an intuitive approach to routing in PHP, enhancing the navigational structure of your application.
- **Slim Framework Base:** Leverages the Slim Framework, providing a powerful and robust base for building applications.
- **Advanced Rendering Techniques:** Supports reactive and lazy page rendering to optimize user experiences.

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

[](#quick-start)

Create and run your next PHP application in a few easy steps:

1. **Project Setup:**

    Initialize a new project using Composer:

    ```
    composer create-project robertkleinschuster/zenith-starter my-new-project
    ```
2. **Development Server:**

    Launch the development server:

    ```
    composer dev
    ```

    Visit your application at .
3. **Add Routes:**

    Introduce new routes to your application easily:

    ```
    composer add-route /about-me
    ```

    **Example:** Access `route/about-me/page.php` via .

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

[](#directory-structure)

Understand the architecture of your project:

```
components/       # Put functional components here
public/           # Webserver document root
routes/           # Route entrypoints
src/              # Object-oriented code for business logic
tests/            # Unit tests

```

Usage Example
-------------

[](#usage-example)

This example demonstrates setting up a user profile page, focusing on automatic route registration, dynamic layouts, and handling form submissions according to the framework's conventions.

### Convention Overview

[](#convention-overview)

- `page.php` files for GET requests and `layout.php` for layouts follow a specific naming and directory structure convention based on the route they serve.
- `action.php` files, for POST requests, are placed alongside `page.php` and `layout.php` files, adhering to the same path-related conventions.

### Step 1: Profile Page and Layout

[](#step-1-profile-page-and-layout)

For the route `/user/{userId}`, arrange the following structure inside the `routes` directory:

- Add `page.php` within `routes/user/{userId}/` to render profile content:

    ```
