Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter4 Route Attribute

Hello everyone.

I designed a Library, which make CodeIgniter4 able to define routing settings of controllers through comments.

This library is a CodeIgniter4 Router presentative way under the PHP8 Attributes feature, it merely provides litte mapping and encapsulation for some CodeIgniter4 Router methods. 

By means of scanning the comments automatically inside the Controller, routes and methods will be connected, enables you to write routing rules straightforwardly, and maintain the relationship between Controllers and Routes in a convenient way.

Quick demo

PHP Code:
namespace App\Controllers;


Ci4Controller extends BaseController
    #[Route(path: 'attr/route', methods: ["get"])]
    public function hello()
        return "PHP8Attributes";

Use the definition of  #[Route(path: 'attr/route', methods: ["get"])], means the same settings were done in your routing configuration:

PHP Code:

This library will smartly connect your controller and routing automatically, which means you can access to the hello method in Ci4Controller through the path of /attr/route.

If you are interested in this library, feel free to visit our Github repository to know how to install and use.

Thank you.

You mean like this, already done.

CodeIgniter4 Route Attribute
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

This i already have from
Codeigniter First, Codeigniter Then You!!


(02-13-2022, 05:42 AM)luckmoshy Wrote: This i already  have from
kenjis cookie clicker

Need a more specific share

Theme © iAndrew 2016 - Forum software by © MyBB