PHPackages                             yllumi/ci4pageroute - 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. yllumi/ci4pageroute

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

yllumi/ci4pageroute
===================

Page based routing for CodeIgniter 4

1.0.4(4y ago)08MITPHPPHP ^7.0

Since Oct 23Pushed 4y ago1 watchersCompare

[ Source](https://github.com/yllumi/ci4pageroute)[ Packagist](https://packagist.org/packages/yllumi/ci4pageroute)[ RSS](/packages/yllumi-ci4pageroute/feed)WikiDiscussions main Synced 2d ago

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

CodeIgniter 4 Page Route
========================

[](#codeigniter-4-page-route)

Develop even more rapid with page based route. It is like Nextjs or Nuxtjs for CodeIgniter 4.

Install
-------

[](#install)

- Install CodeIgniter 4
- Run composer `composer require yllumi/ci4pageroute`
- Change 2 line of Config/Routes.php in CodeIgniter like this: ```
    $routes->set404Override('\Yllumi\Pager\Controllers\Page::index');
    $routes->get('/', '\Yllumi\Pager\Controllers\Page::index');
    ```
- Run `composer run -d vendor/yllumi/ci4pageroute add-sample-page` to place sample pages
- Happy develop!

Create Page
-----------

[](#create-page)

Page based route use [Latte template engine](https://latte.nette.org/) to build page structure.

By default page is placed inside folder `pages/` in root project.

```
project/
  app/
  pages/
    index.html
    meta.yml
  public/
  test/
  vendor/
  writable/

```

To make the page work, you must create at least two files, `meta.yml` and `index.html`. `meta.yml` is used to define page properties and `index.html` is the page template itself.

For example, create `meta.yml` inside folder `pages/` like this:

```
page_title: Home
```

and create `index.html` in the same place:

```

  {$page_title}

  Welcome!

```

You can then call your app in browser and the root homepage will show those page files.

### Write PHP Operation

[](#write-php-operation)

You also can write any PHP code just like you do in controller by creating file `Action.php` in the same place, with this structure:

```
