MufidJamaluddin / Codeigniter4-HMVC

CodeIgniter 4 Starter with HMVC
MIT License
66 stars 39 forks source link

Your codes can be upgrade to 4.5.4 #18

Open bruosama opened 1 month ago

bruosama commented 1 month ago

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

/**

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

/**

//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 commented 1 month ago

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.