fingerprintsketch:generate

The primary command in Sketch package is sketch:generate. This command processes your YAML file and generates all the necessary files for your Laravel application.

Basic Usage

php artisan sketch:generate --file=path/to/your/schema.yaml

Command Option

Option
Mandatory
Description

--file

required

Path to your YAML schema file

--option

nullable

Override existing files

--service-repository

nullable

Generate both service and repository layers

--service-only

nullable

Generate service layer only

--repository-only

nullable

Generate repository layer only

Examples

Basic Generation

php artisan sketch:generate --file=post.yaml

Using Relative Path

php artisan sketch:generate --file=database/schemas/post.yaml

Using Absolute Path

php artisan sketch:generate --file=/var/www/html/your-project/schemas/post.yaml

Using Force Flag

The --force flag allows you to override existing files. This is useful when you want to regenerate files after making changes to your YAML schema.

Without Force Flag

When you run the command without --force, the command will:

  • Skip generating files that already exist

  • Show warning messages for skipped files

Output

With Force Flag

Using the --force flag will:

  • Override any existing files

  • Generate fresh copies of all files

Output

Best Practice for Using Force Flag

  • Version Control: Always commit your changes before using --force

  • Development Environment: Only use --force in development environment

  • Backup: Consider backing up existing files before using --force

  • Review Changes: After using --force, review the generated files to ensure everything is as expected

Common Scenarios for Using Force Flag

Schema Updates

Multiple Generations

Development Iterations

Last updated