Code Monkey home page Code Monkey logo

generator-laravel-package-scaffolder's Introduction

Yeoman Laravel Package Generator

Node.js CI Code Climate maintainability Scrutinizer Code Climate issues

What's this about then

This Yeoman generator will quickly and easily scaffold a Laravel package, getting you up and running within a few seconds.

It will generate the necessary files such as a service provider and a composer file, while also generating placeholder directories for migrations, translations etc.

The service provider will be configured with all the correct settings for loading and/or publishing your assets. Just uncomment what you need and you're done.

For a full overview of the scaffolded files, have a look over here.

Installation

If you haven't done so already, install the Yeoman generator:

npm install -g yo

After that, install the scaffolder generator:

npm install -g generator-laravel-package-scaffolder

Using the generator

Run the following command:

yo laravel-package-scaffolder

and follow the instructions.

The resulting scaffolded package

Given a package with the name "MyPackage", the resulting package will have the following directory structure and files:

.
├── README.md
├── .gitignore
├── composer.json
├── config
│   └── my-package.php
├── database
│   └── migrations
│       └── .gitignore
├── phpstan.neon
├── phpunit.xml
├── public
│   └── .gitignore
├── resources
│   ├── lang
│   │   └── .gitignore
│   └── views
│       └── .gitignore
├── routes
│   └── web.php
├── src
│   ├── Console
│   │   └── Commands
│   │       └── MyPackageCommand.php
│   ├── Providers
│   │   └── MyPackageServiceProvider.php
└── tests
    └── TestCase.php

Using your package

If you want to use your package on the local filesystem in a Laravel app for development purposes, include the package in the app's composer.json file:

"repositories": [
    {
        "type": "path",
        "url": "path/to/your/package/root"
    }
],

Next, add your package to the require section of the app's composer.json file:

"require": {
    "vendor/package": "*"
}

After the composer.json file has been updated, run the composer update command:

composer update

This will symlink the package into the app's vendor dir.

Note: If you update your package's composer.json file, you need to run the composer update command again to update the app's autoloader.

This is only necessary for the composer.json file. Changes in any other files in your package will be automatically updated thanks to the symlink.

Testing your package

This generator automatically adds PHPUnit for unit testing and PHPStan for static analysis. Both are added to the composer.json scripts attribute. You can run them using:

  • composer run test
  • composer run analysis

Contributing

See CONTRIBUTING.md.

Changelog

See CHANGELOG.md.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Testing

The generator is fully backed (well, almost fully backed 😐) by unit tests. The test runner of choice is Jest.

Running Tests

jest

Generating code coverage

jest --coverage --coverageDirectory=coverage/jest

generator-laravel-package-scaffolder's People

Contributors

atymic avatar dependabot-preview[bot] avatar dependabot[bot] avatar verschuur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

atymic yomaaf egyjs

generator-laravel-package-scaffolder's Issues

Error : Email required

Discussed in #294

Originally posted by Ronan-Lenor March 16, 2022
Hello,
after executing yo laravel-package-scaffolder, i got this error :

Fetching GitHub info, please wait...
Error laravel-package-scaffolder

Email required

i don't understand from where it try to get those infos.
what step i'm missing?

Ability to pick the minimum major laravel version

Not sure if you think this is a good idea, but having a way to select the minimum major version could be useful.

For example, laravel 7.x will be out in a few days, but most packages would still want to support laravel 6.x, however if they need features only available in 7.x, it could be useful to have a switch/question when generating.

Happy to PR :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.