Download the PHP package yllumi/ci4-pages without Composer

On this page you can find all versions of the php package yllumi/ci4-pages. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ci4-pages

ci4-pages

tests build

ci4-pages is a package for CodeIgniter 4 that provides a page-based routing mechanism. This package simplifies routing management with a file-based and folder-structured approach, making it suitable for projects requiring dynamic routing. Think of it as similar to Next.js or Laravel Folio but maintaining the coding style unique to CodeIgniter 4.

Installation

Install this package via Composer with the following command:

Configuration

Register the pageview_helper in app/Controllers/BaseController.php

Usage

Create a folder named app/Pages/. This folder will be used to store all your page controller files.

Each folder inside app/Pages/ will represent a page route. For example, the folder app/Pages/home will be accessible at domain.com/home. Similarly, the folder app/Pages/profile/achievement/ will be accessible at domain.com/profile/achievement/.

There is one mandatory file that must exist in the pages folder, namely PageController.php, which will handle page requests. Besides that, you can create other .php files for views and so on.

Let's look at an example code below:

app/Pages/home/PageController.php

app/Pages/home/index.php

In the example above, we created two files. The first is PageController.php, a controller class with one method getIndex(). This method handles requests to mydomain.com/home or mydomain.com/home/index.

The getIndex() method can have parameters that capture the URI segment after the page segment. For instance, in the example above, you can call domain.com/home/Toni or domain.com/home/index/Toni, where the string 'Toni' will be received by the $name parameter of the getIndex() method.

In the example above, the getIndex() method returns the output of the pageView() function. This function is similar to view() in CodeIgniter but is adjusted to accept the path of the view file located under the app/Pages/ folder. return pageView('home/index', $data); means it returns the view file app/Pages/home/index.php.

In addition to the getIndex() method, you can also create other methods i.e. getDetail() or postInsert(). Only methods whose names start with an HTTP verb can handle HTTP requests. The method naming mechanism in this controller is the same as the Auto Route (improved) provided by CodeIgniter 4. Method getDetail() for example, can be accessed from mydomain.com/home/detail/[id].

API Endpoint

You can also return RESTful responses by adding the ResponseTrait to the controller class.

app/Pages/home/PageController.php

For more information about the API Response Trait, refer to the CodeIgniter documentation here: API Responses Trait.

Combination with Manual Routes

You can still use the Manual Route mechanism alongside the Auto Route (Improved) provided by CodeIgniter 4 in conjunction with this page-based routing. The execution order of the routers is [manual route] - [page-based route] - [auto route].

Page Template Generator

You can run this spark command to create a new page folder and files:

This command will create a new page folder with its sample controller and view file.

Contribution

We welcome community contributions! If you have ideas or find bugs, feel free to submit a pull request or open an issue in this repository.

License

Similar to the CodeIgniter 4 repository, this package is licensed under the MIT license. See the LICENSE file for more details.


All versions of ci4-pages with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
codeigniter4/framework Version ^4.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package yllumi/ci4-pages contains the following files

Loading the files please wait ....