CodeIgniter Forums
Add initController section in spark make:controller - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: Add initController section in spark make:controller (/showthread.php?tid=92515)



Add initController section in spark make:controller - Corsari - 02-25-2025

Hello, in my personal opinion
It would be logical for
Code:
php spark make:controller

to include the

Code:
initController()

skeleton as part of its default template, similar to how it handles models with make:model . 

The parallel with

Code:
make:model

is fitting: when you generate a model with PHP Spark, it comes populated with various default settings that you can adapt or remove based on your needs. Applying the same approach to controllers would make sense.
Considering that:
  • Most controllers end up needing at least one model
  • The implementation of initController() follows a fairly standard pattern
  • It's easier to remove unnecessary code than to remember to add important code
This would help developers adopt the best practices suggested by the framework.

Regards
R.


RE: Add initController section in spark make:controller - ozornick - 02-26-2025

Can you create a PR for improvement?


RE: Add initController section in spark make:controller - Corsari - 02-26-2025

Hello
Sorry
What is a PR ?
Thank you for clarifying


RE: Add initController section in spark make:controller - JustJohnQ - 02-26-2025

A PR is a pull request on github and is used to request a feature or improvement to Codeigniter.
See this site: https://github.com/codeigniter4/CodeIgniter4/pulls


RE: Add initController section in spark make:controller - Corsari - 02-26-2025


I have written here , given the name of the forum section

but , sure I'll write it in github too

--------

Sorry tried , looks a mess

Can you kindly explain what to set to get the button for pulling a request?

Thank you


RE: Add initController section in spark make:controller - ozornick - 02-26-2025

Read https://github.com/codeigniter4/CodeIgniter4/tree/develop/contributing
Your bug report (issue) will probably be closed.