• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CLI Generator support

#1
Like Symfony and Laravel, CI needs a CLI Generator which will help developers to make controller, model, library more quickly.
Reply

#2
(05-26-2015, 11:17 PM)itsmeka Wrote: Like Symfony and Laravel, CI needs a CLI Generator which will help developers to make controller, model, library more quickly.

Having generator is a Plus.
But I think that it should supports only complex things as CRUD system or RESTful resource.
There is no point and its not really helpful to use cli to generate 1 controller/model file..
Best VPS Hosting : Digital Ocean
Reply

#3
(05-27-2015, 02:08 AM)sv3tli0 Wrote:
(05-26-2015, 11:17 PM)itsmeka Wrote: Like Symfony and Laravel, CI needs a CLI Generator which will help developers to make controller, model, library more quickly.

Having generator is a Plus.
But I think that it should supports only complex things as CRUD system or RESTful resource.
There is no point and its not really helpful to use cli to generate 1 controller/model file..

REST and CRUD are only as complex as you want them to be. While I found a generator helpful when I first started using CI, in time I found it faster to put together the code I needed from my own head or pieces of other code I had already written. Bonfire's web-based generator will create a full module (controllers, model, views, migrations, config, language files), but it doesn't get updated or tested as thoroughly as it should because it tends to be less useful to more experienced developers, and there's only so much that can be done to change that.
Reply

#4
(05-28-2015, 08:53 AM)mwhitney Wrote:
(05-27-2015, 02:08 AM)sv3tli0 Wrote:
(05-26-2015, 11:17 PM)itsmeka Wrote: Like Symfony and Laravel, CI needs a CLI Generator which will help developers to make controller, model, library more quickly.

Having generator is a Plus.
But I think that it should supports only complex things as CRUD system or RESTful resource.
There is no point and its not really helpful to use cli to generate 1 controller/model file..

REST and CRUD are only as complex as you want them to be. While I found a generator helpful when I first started using CI, in time I found it faster to put together the code I needed from my own head or pieces of other code I had already written. Bonfire's web-based generator will create a full module (controllers, model, views, migrations, config, language files), but it doesn't get updated or tested as thoroughly as it should because it tends to be less useful to more experienced developers, and there's only so much that can be done to change that.

I agree with CRUD generator and a few .coffee + .scss asset files (inside application/assets folder). CI4 doesn't need Scaffold. It needs a Scaffold Generator. I started this one like 2 years ago and update it if I have time https://www.youtube.com/watch?v=xW_o5flX3WU for the purpose of creating projects very fast with customized dashboards and stuff at that time. Another good feature would be to also destroy the generated files similar to Rails. No need to use HTML classes for the UI. It has to be bear.
Long live CodeIgniter!
Reply

#5
This was discussed early on and I believe the decision was that nothing like this would ship with CodeIgniter, but might show up as a separate project that could be used. Sprint already has a pretty good start at this, and I know that a lot of other people have built their own versions, also, so I'm sure if we put our heads together we could create something pretty nice. IMHO, though, it should be framework-agnostic, but that's just me.
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply

#6
Sprint scaffold is nice.

The use of official scaffold generator would be beneficial for CI4 users to generate an entire CRUD structure in just one go. It's tedious to create similar files over and over again or create a personal generator (which would take a bit of time to create) or look for plugins that have different conventions but would produce similar and opinionated output in the end.

Generated files might involve bare files. An example would be like scaffold generate User:
  1. Controllers/User.php (with namespace and CRUD methods)
  2. Models/UserModel.php
  3. Views/User/index.php, create.php, read.php, update.php, delete.php
  4. Migrations/User_{TimeStamp}.php
  5. Seeds/User.php
  6. Routes
  7. Form validation (under application/Config/FormValidation.php: $config['user'] = ['create' => [], 'read' => []])
  8. Helpers/User.php
  9. Libraries/User.php
  10. UnitTests/UserTest.php
  11. Assets (application/ThirdParty/Assets/Scripts/user.coffee and application/ThirdParty/Assets/Styles/user.sass)

The generator might include a "destroy" command like scaffold destroy User, which will remove all the generated User-related files, also, in one go.
Long live CodeIgniter!
Reply

#7
(06-30-2016, 06:23 AM)prezire Wrote: Migrations/User_{TimeStamp}.php
Helpers/User.php
Libraries/User.php

You should NEVER need such things.

(06-30-2016, 06:23 AM)prezire Wrote: Assets (application/ThirdParty/Assets/Scripts/user.coffee and application/ThirdParty/Assets/Styles/user.sass)

These so called "assets" are front-end components, and that's not a PHP framework's job to manage.
Reply

#8
This is a "slippery slope" because it would lead to lost time in debates over "best practices" and take away from the work on the core framework getting completed. So probably best as a separate project.
Reply

#9
Hi all... new to the forums, but not to CI, been using CI since v2 - very happy to be building with CI4 now - Well Done to the Team!
---
I am looking for something like this too - agreed it should be separate, probably even live outside of your application - but it would be cool to go generate "User" and after several optional prompts it generates the code... operationally its a webapp you spin up and gives you a GUI for the whole thing...
Example core generators: User, Blog
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.