Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

CrestApps's avatar

Can you help me make my code better? Please review my code

It is my first time writing a composer package for Laravel and publishing it on GitHub free for all. It feels great to finally be able to contribute back to this awesome community. In advance thank you for using my package, I hope you enjoy it while saving time and money.

My project is a code generator for the awesome Laravel framework. It helps the user generate resources like views, controllers, routes, language files or form request from the command line.

I would love it if you digs into my code and leave me some feedback. However, I am more interested in reviewing the code that the package generate. I want to make sure that my package generates a high standard code to set the foundation high for all users. Reviewing my code will mainly benefit me, while reviewing the generated code will benefit every user as they will start their project with a fine tuned code.

Package Name: Laravel Code Generator

Package Description: A clean code generator for Laravel framework that will save you time! This awesome tool will help you generate resources like views, controllers, routes, migration, language or request forms! It is extremely flexible and customizable. It is shipped with cross-browsers compatibility template, and client-side validation to make your application awesome.

Package Repository: https://github.com/CrestApps/laravel-code-generator

Package Documentation: https://crestapps.com/laravel-code-generator/docs/1.0

Feature Highlights:

  • Create full resource using a single command with/without migration or from existing database.
  • Allows you to save the field in a json file and recreate resources when the business need change.
  • Create standard CRUD controllers with simple or form-request validation.
  • Create model with relations.
  • Create named routes with and without group.
  • Create standard CRUD views.
  • Very flexible and rich with configurable options.
  • (Beta) Client-side validation.
  • File uploading handling.
  • Auto multiple-response storing in the database.
  • Create form-request.
  • Customizable view’s templates to enable you to change the standard look and feel of your application.
  • Create view's layouts with and without client-side validation.
  • Change the template at run time to generate different views.
0 likes
11 replies
jlrdw's avatar

I like the fact it will work from existing database as some applications already exist and have an existing database. Laravel Collective Forms & HTML package should be optional.

1 like
CrestApps's avatar

@jlrdw the end goal is to be able understand the database "by evaluating foreign key reference and build the relation as well"

Making Laravel Collective Forms & HTML a requirements makes coding the template a lot easier which is why it is required. I will consider making it optional at some point.

jlrdw's avatar

Yeah because I see a lot of the regulars on the forum not using the collective anymore but they still use blade where as myself I don't even use blade I just use PHP and HTML old school.

jlrdw's avatar

@CrestApps of course not, many people like code generators, I and others just don't use the laravel collective. But it would be easy enough to still use the generator, and just re-write a view if needed.

CrestApps's avatar

@jlrdw I just published a new release of Laravel-Code-Generator that completely removes Laravel-Collective as dependency.

By default, it will not to use Laravel-Collective which actually gave me more flexibility and get creative with the template. For example, creating a palceholder for the menu, selectRange and selectMonth.

Even thought the new version v1.1.0 does not depend on Laravel-Collective, it fully supports it. Anyone still likes to use Laravel-Collective will still be able to. v1.1.0 ships with a full template based on Laravel-Collective.

I also created a new documentation for the new version since the installation process changes and I made slight changes to the commands https://crestapps.com/laravel-code-generator/docs/1.1

I am still using blade for the default template, but you can easily make your own template without blade. In fact, the template is so flexible, you can do anything that you need with the template.

I hope you get to try the new version and share your thoughts.

Please or to participate in this conversation.