Home

Awesome

Laravel-kodyfire

Version Documentation License: MIT

Generate Laravel models, migrations and more using Kodyfire.

Homepage

Requirements

laravel-kodyfire requires the kodyfire-cli to be installed

npm install -g kodyfire-cli

Install

npm i laravel-kodyfire

Usage

Method 1: As a generator

In order to generate your artifacts, run the generate command. The syntax is kody generate|g [kody] [concept]. If you ommit kody and concept the assistant will prompt you to select them. As an example, run the following command from your terminal:

kody generate laravel model

or you can you the shorthand generation command

kody g laravel:model YourModelName

The shorthand will execute without prompting if no additional arguments are required

You can also create related artifacts by providing the --includes option with a list of comma seperated artifacts

kody g laravel:model YourModelName --includes migration,seeder,factory

In order to list available concepts, run the following command:

kody ls laravel

To list available templates run:

kody ls laravel -s templates

To use a different template run

kody g laravel:model YourModelName --overwrites template:templateName

When providing a template name ommit the prefix and extension part of the template name. For example if the template name is controller.api.php.template, You should overwrite the template as follow:

kody g laravel:controller YourControllerlName --overwrites template:api

--overwrites are the concept arguments. In order to list available arguments of all concepts run the following command:

kody ls laravel -s overwrites

Method 2: As an importer

You can use a source containing the definition of the artifacts you want to create at once. Available sources: yaml, plantuml(class diagram). As an example, A declaration for the yaml laravel source import file might look like the following

models:
  user:
    fields:
      name: string
      email: string nullable unique
      status: enum:active,inactive default:active
      password,phone,role: string nullable
      email_verified_at: timestamp nullable
    hidden: password
    relations:
      belongsTo: Company
	  ...

After adding your definitions, run the following command to import your assets.

kody import laravel migration,model -s import.yaml

Using your own templates

Since every project has its specificity, you can always overwrite the default templates provided by the package. In order to start using your own templates, you must publish the default templates into your root project under .kody/laravel-kodyfire. To do so run

kody publish laravel

or

kody publish laravel templateName

if you want to overwrite a single template

After updating the published template content. Test drive your template by running

kody g model yourModelName

Available concepts TODO

concept (default)

Generates a generic concept

model

Generates a model class

controller

Generates a controller class

request

Generates a request class

resource

Generates a resource class

collection

Generates a collection class

event

Generates an event class

listener

Generates a listener class

subscriber

Generates a subscriber class

observer

Generates a observer class

policy

Generates a policy class

factory

Generates a factory class

seeder

Generates a seeder class

test

Generates a test class

testUnit

Generates a unit test class

middleware

Generates a middleware class

repository

Generates a repository class

Usage
kody g laravel yourConcept
Arguments
Options

📅 Future Features

Author

Anis Marrouchi

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

Credits

📝 License

Copyright © 2022 Anis Marrouchi.

This project is MIT licensed.


This README was generated with ❤️ by readme-kodyfire