Codeigniter4-HMVC icon indicating copy to clipboard operation
Codeigniter4-HMVC copied to clipboard

Your codes can be upgrade to 4.5.4

Open bruosama opened this issue 1 year ago • 2 comments

My PHP version 8.3.10

These are the steps i done

composer create-project mufidjamaluddin/codeigniter4-hmvc ci4-hmvc

cd ci4-hmvc copy folder Config from ci4 latest 4.5.4 overwrite

copy index and spark

cp vendor/codeigniter4/framework/public/index.php public/index.php cp vendor/codeigniter4/framework/spark spark

copy env to .env edit .env uncomment app.baseURL = 'http://ci4-hmvc.test/'

Config/Routes.php tambah ini

/**


  • HMVC Routing

*/

foreach(glob(APPPATH . 'Modules/*', GLOB_ONLYDIR) as $item_dir) { if (file_exists($item_dir . '/Config/Routes.php')) { require_once($item_dir . '/Config/Routes.php'); } }

Config/Routing.php comment dan tukar

/** * For Defined Routes and Auto Routing. * The default namespace to use for Controllers when no other * namespace has been specified. * * Default: 'App\Controllers' */ //public string $defaultNamespace = 'App\Controllers'; public string $defaultNamespace = 'App\Modules\Land\Controllers';

//nota - working php spark list php spark app:info php spark env

Create Module - working

php spark module:create User

Browse to... http://ci4-hmvc.test/user

ERROR!

syntax error, unexpected token \

Fatal error: Uncaught Error: Call to undefined method CodeIgniter\Debug\ExceptionHandler::cleanPath() in E:\laragon-6.0.0\www\ci4-hmvc\app\Views\errors\html\error_exception.php:33 Stack trace: #0 E:\laragon-6.0.0\www\ci4-hmvc\vendor\codeigniter4\framework\system\Debug\BaseExceptionHandler.php(266): include() #1 E:\laragon-6.0.0\www\ci4-hmvc\vendor\codeigniter4\framework\system\Debug\BaseExceptionHandler.php(269): CodeIgniter\Debug\BaseExceptionHandler->CodeIgniter\Debug{closure}() #2 E:\laragon-6.0.0\www\ci4-hmvc\vendor\codeigniter4\framework\system\Debug\ExceptionHandler.php(114): CodeIgniter\Debug\BaseExceptionHandler->render(Object(ParseError), 500, 'E:\laragon-6.0....') #3 E:\laragon-6.0.0\www\ci4-hmvc\vendor\codeigniter4\framework\system\Debug\Exceptions.php(163): CodeIgniter\Debug\ExceptionHandler->handle(Object(ParseError), Object(CodeIgniter\HTTP\IncomingRequest), Object(CodeIgniter\HTTP\Response), 500, 1) #4 [internal function]: CodeIgniter\Debug\Exceptions->exceptionHandler(Object(ParseError)) #5 {main} thrown in E:\laragon-6.0.0\www\ci4-hmvc\app\Views\errors\html\error_exception.php on line 33

Please help me to fix this. Thanks!

bruosama avatar Aug 16 '24 15:08 bruosama

OK I found it!

to get new UI for errors: copy folder app/Views/errors from ci4 latest 4.5.4 and overwrite. Then you can see syntax errors show in debug page

Fixed

app/Views/user/dashboard.php buang \

<tbody>
        <?php foreach ($data ?? [] as $key => $itemUser):?>
            <tr>
                <td><?=$itemUser->getId() ?? "" ?></td>
                <td><?=$itemUser->getName() ?? "" ?></td>
            </tr>
        <?php endforeach;?>
        </tbody>

DONE.

bruosama avatar Aug 16 '24 16:08 bruosama

OK I found it!

to get new UI for errors: copy folder app/Views/errors from ci4 latest 4.5.4 and overwrite. Then you can see syntax errors show in debug page

Fixed

app/Views/user/dashboard.php buang \

<tbody>
        <?php foreach ($data ?? [] as $key => $itemUser):?>
            <tr>
                <td><?=$itemUser->getId() ?? "" ?></td>
                <td><?=$itemUser->getName() ?? "" ?></td>
            </tr>
        <?php endforeach;?>
        </tbody>

DONE.

nice, bisa buat 4.6.3 juga pak?

mdestafadilah avatar Oct 13 '25 02:10 mdestafadilah