master 1de707a0bfba cached
33 files
38.2 KB
10.4k tokens
41 symbols
1 requests
Download .txt
Repository: melihovv/laravel-package-generator
Branch: master
Commit: 1de707a0bfba
Files: 33
Total size: 38.2 KB

Directory structure:
gitextract_wkweo582/

├── .editorconfig
├── .gitattributes
├── .github/
│   └── workflows/
│       └── default.yml
├── .gitignore
├── .styleci.yml
├── LICENSE
├── README.md
├── composer.json
├── config/
│   └── package-generator.php
├── skeleton/
│   ├── .editorconfig
│   ├── .gitattributes.tpl
│   ├── .github/
│   │   └── workflows/
│   │       └── default.yml
│   ├── .gitignore.tpl
│   ├── .styleci.yml
│   ├── LICENSE.tpl
│   ├── README.md.tpl
│   ├── composer.json.tpl
│   ├── phpunit.xml
│   └── src/
│       └── ServiceProvider.php.tpl
├── src/
│   ├── Commands/
│   │   ├── PackageNew.php
│   │   ├── PackageRemove.php
│   │   └── Traits/
│   │       ├── ChangesComposerJson.php
│   │       ├── CopiesSkeleton.php
│   │       ├── InteractsWithComposer.php
│   │       ├── InteractsWithGit.php
│   │       ├── InteractsWithUser.php
│   │       └── ManipulatesPackageFolder.php
│   ├── Exceptions/
│   │   └── RuntimeException.php
│   └── ServiceProvider.php
└── stubs/
    ├── Facade.php.tpl
    ├── MainClass.php.tpl
    ├── MainClassTest.php.tpl
    └── config.php

================================================
FILE CONTENTS
================================================

================================================
FILE: .editorconfig
================================================
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
indent_style = tab

[*.php]
indent_size = 4


================================================
FILE: .gitattributes
================================================
* text=auto
/.github export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/.styleci.yml export-ignore
/.sensiolabs.yml export-ignore
/.coveralls.yml export-ignore
/phpunit.xml export-ignore
/CHANGELOG-* export-ignore
/CONTRIBUTING.md export-ignore
/CODE_OF_CONDUCT.md export-ignore


================================================
FILE: .github/workflows/default.yml
================================================
name: Run tests

on:
  push:
  schedule:
    - cron: '0 0 * * *'

jobs:
  php-tests:
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        php: [7.4, 7.3, 7.2]
        laravel: [8.*, 7.*, 6.*]
        dependency-version: [prefer-lowest, prefer-stable]
        os: [ubuntu-latest, windows-latest]
        include:
          - laravel: 8.*
            testbench: 6.*
          - laravel: 7.*
            testbench: 5.*
          - laravel: 6.*
            testbench: 4.*
        exclude:
          - laravel: 8.*
            php: 7.2

    name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

    steps:
      - name: Checkout code
        uses: actions/checkout@v1

      - name: Setup PHP
        uses: shivammathur/setup-php@v1
        with:
          php-version: ${{ matrix.php }}
          extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
          coverage: none

      - name: Install dependencies
        run: |
          composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
          composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest


================================================
FILE: .gitignore
================================================
/vendor
/.idea/
/node_modules
/composer.lock
/.phpunit.result.cache


================================================
FILE: .styleci.yml
================================================
preset: laravel


================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2016 Alexander Melihov <amelihovv@ya.ru>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



================================================
FILE: README.md
================================================
Laravel package generator
=========================

[![GitHub Workflow Status](https://github.com/melihovv/laravel-package-generator/workflows/Run%20tests/badge.svg)](https://github.com/melihovv/laravel-package-generator/actions)
[![styleci](https://styleci.io/repos/96041272/shield)](https://styleci.io/repos/96041272)

[![Packagist](https://img.shields.io/packagist/v/melihovv/laravel-package-generator.svg)](https://packagist.org/packages/melihovv/laravel-package-generator)
[![Packagist](https://poser.pugx.org/melihovv/laravel-package-generator/d/total.svg)](https://packagist.org/packages/melihovv/laravel-package-generator)
[![Packagist](https://img.shields.io/packagist/l/melihovv/laravel-package-generator.svg)](https://packagist.org/packages/melihovv/laravel-package-generator)

Simple package to quickly generate basic structure for other laravel packages.

## Install

Install via composer
```bash
composer require --dev melihovv/laravel-package-generator
```

Publish package config if you want customize default values
```bash
php artisan vendor:publish --provider="Melihovv\LaravelPackageGenerator\ServiceProvider" --tag="config"
```

## Available commands

### php artisan package:new -i {vendor} {package}

Create new package.

Example: `php artisan package:new Melihovv SomeAwesomePackage`

This command will:

* Create `packages/melihovv/some-awesome-package` folder
* Register package in app composer.json
* Copy package skeleton from skeleton folder to created folder (you can provide
your custom skeleton path in config)
* Run `git init packages/melihovv/some-awesome-package`
* Run `composer update melihovv/some-awesome-package`
* Run `composer dump-autoload`

With interactive `-i` flag you will be prompted for every needed value from you.

### php artisan package:remove {vendor} {package}

Remove the existing package.

Example: `php artisan package:remove Melihovv SomeAwesomePackage`

This command will:

* Run `composer remove melihovv/some-awesome-package`
* Remove `packages/melihovv/some-awesome-package` folder
* Unregister package in app composer.json
* Run `composer dump-autoload`

Interactive mode also possible.

## Custom skeleton

This package will copy all folders and files from specified skeleton path to
package folder. You can use templates in your skeleton. All files with `tpl`
extension will be provided with some variables available to use in them. `tpl`
extension will be stripped.

Available variables to use in templates:

* vendor (e.g. Melihovv)
* package (e.g. SomeAwesomePackage)
* vendorFolderName (e.g. melihovv)
* packageFolderName (e.g. some-awesome-package)
* packageHumanName (e.g. Some awesome package)
* composerName (e.g. melihovv/some-awesome-package)
* composerDesc (e.g. A some awesome package)
* composerKeywords (e.g. some,awesome,package)
* licence (e.g. MIT)
* phpVersion (e.g. >=7.0)
* aliasName (e.g. some-awesome-package)
* configFileName (e.g. some-awesome-package)
* year (e.g. 2017)
* name (e.g. Alexander Melihov)
* email (e.g. amelihovv@ya.ru)
* githubPackageUrl (e.g. https://github.com/melihov/some-awesome-package)

## Things you need to do manually:

* In README.md:
  * StyleCI repository identifier
  * Package description
  * Usage section

## Security

If you discover any security related issues, please email amelihovv@ya.ru instead of using the issue tracker.

## Credits

- [Alexander Melihov](https://github.com/melihovv)
- [All contributors](https://github.com/melihovv/laravel-package-generator/graphs/contributors)


================================================
FILE: composer.json
================================================
{
  "name": "melihovv/laravel-package-generator",
  "description": "A laravel package generator",
  "license": "MIT",
  "keywords": [
    "laravel",
    "package",
    "generator"
  ],
  "type": "library",
  "authors": [
    {
      "name": "Alexander Melihov",
      "email": "amelihovv@ya.ru"
    }
  ],
  "require": {
    "php": ">=7.2",
    "illuminate/container": "^6.0|^7.0|^8.0",
    "illuminate/console": "^6.0|^7.0|^8.0",
    "illuminate/filesystem": "^6.0|^7.0|^8.0",
    "illuminate/support": "^6.0|^7.0|^8.0",
    "illuminate/view": "^6.0|^7.0|^8.0"
  },
  "autoload": {
    "psr-4": {
      "Melihovv\\LaravelPackageGenerator\\": "src"
    }
  },
  "extra": {
    "laravel": {
      "providers": [
        "Melihovv\\LaravelPackageGenerator\\ServiceProvider"
      ]
    }
  },
  "config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true
  }
}


================================================
FILE: config/package-generator.php
================================================
<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Custom skeleton directory path
    |--------------------------------------------------------------------------
    |
    | This value allows to override default package skeleton.
    | Relative to base project path. Example: storage/skeleton.
    |
    */

    'skeleton_dir_path' => null,

];


================================================
FILE: skeleton/.editorconfig
================================================
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
indent_style = tab

[*.php]
indent_size = 4


================================================
FILE: skeleton/.gitattributes.tpl
================================================
* text=auto
/.github export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/.styleci.yml export-ignore
/.sensiolabs.yml export-ignore
/.coveralls.yml export-ignore
/phpunit.xml export-ignore
/CHANGELOG-* export-ignore
/CONTRIBUTING.md export-ignore
/CODE_OF_CONDUCT.md export-ignore


================================================
FILE: skeleton/.github/workflows/default.yml
================================================
name: Run tests

on:
  push:
  schedule:
    - cron: '0 0 * * *'

jobs:
  php-tests:
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        php: [7.4, 7.3, 7.2]
        laravel: [7.*, 6.*]
        dependency-version: [prefer-lowest, prefer-stable]
        os: [ubuntu-latest, windows-latest]
        include:
          - laravel: 8.*
            testbench: 6.*
          - laravel: 7.*
            testbench: 5.*
          - laravel: 6.*
            testbench: 4.*
        exclude:
          - laravel: 8.*
            php: 7.2

    name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

    steps:
      - name: Checkout code
        uses: actions/checkout@v1

      - name: Setup PHP
        uses: shivammathur/setup-php@v1
        with:
          php-version: ${{ matrix.php }}
          extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
          coverage: none

      - name: Install dependencies
        run: |
          composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
          composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest

      - name: Execute tests
        run: ./vendor/bin/phpunit


================================================
FILE: skeleton/.gitignore.tpl
================================================
/vendor
/.idea
/node_modules
/composer.lock
/.phpunit.result.cache


================================================
FILE: skeleton/.styleci.yml
================================================
preset: laravel


================================================
FILE: skeleton/LICENSE.tpl
================================================
The MIT License (MIT)

Copyright (c) <?php echo $year; ?> <?php echo $name; ?> <<?php echo $email; ?>>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.



================================================
FILE: skeleton/README.md.tpl
================================================
# <?php echo "$packageHumanName\n"; ?>

[![GitHub Workflow Status](https://github.com/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>/workflows/Run%20tests/badge.svg)](https://github.com/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>/actions)
[![styleci](https://styleci.io/repos/CHANGEME/shield)](https://styleci.io/repos/CHANGEME)

[![Packagist](https://img.shields.io/packagist/v/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>.svg)](https://packagist.org/packages/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>)
[![Packagist](https://poser.pugx.org/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>/d/total.svg)](https://packagist.org/packages/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>)
[![Packagist](https://img.shields.io/packagist/l/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>.svg)](https://packagist.org/packages/<?php echo $vendorFolderName; ?>/<?php echo $packageFolderName; ?>)

Package description: CHANGE ME

## Installation

Install via composer
```bash
composer require <?php echo $vendorFolderName; ?>/<?php echo "$packageFolderName\n"; ?>
```

### Publish package assets

```bash
php artisan vendor:publish --provider="<?php echo $vendor; ?>\<?php echo $package; ?>\ServiceProvider"
```

## Usage

CHANGE ME

## Security

If you discover any security related issues, please email <?php echo "$email\n"; ?>
instead of using the issue tracker.

## Credits

- [<?php echo $name; ?>](<?php echo $githubPackageUrl; ?>)
- [All contributors](<?php echo $githubPackageUrl; ?>/graphs/contributors)

This package is bootstrapped with the help of
[melihovv/laravel-package-generator](https://github.com/melihovv/laravel-package-generator).


================================================
FILE: skeleton/composer.json.tpl
================================================
{
  "name": "<?php echo $composerName; ?>",
  "description": "<?php echo $composerDesc; ?>",
  "license": "<?php echo $license; ?>",
  "keywords": [
    <?php echo "$composerKeywords\n"; ?>
  ],
  "type": "library",
  "authors": [
    {
      "name": "<?php echo $name; ?>",
      "email": "<?php echo $email; ?>"
    }
  ],
  "require": {
    "php": "<?php echo $phpVersion; ?>",
    "illuminate/support": "^6.0|^7.0|^8.0"
  },
  "require-dev": {
    "orchestra/testbench": "^4.0|^5.0|^6.0",
    "phpunit/phpunit": "^8.4|^9.0"
  },
  "autoload": {
    "psr-4": {
      "<?php echo $vendor; ?>\\<?php echo $package; ?>\\": "src"
    }
  },
  "autoload-dev": {
    "psr-4": {
      "<?php echo $vendor; ?>\\<?php echo $package; ?>\\Tests\\": "tests"
    }
  },
  "scripts": {
    "phpunit": "phpunit"
  },
  "extra": {
    "laravel": {
      "providers": [
        "<?php echo $vendor; ?>\\<?php echo $package; ?>\\ServiceProvider"
      ]
    }
  },
  "config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true
  }
}


================================================
FILE: skeleton/phpunit.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="vendor/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false">
  <testsuites>
    <testsuite name="package">
      <directory suffix="Test.php">tests</directory>
    </testsuite>
  </testsuites>
  <filter>
    <whitelist processUncoveredFilesFromWhitelist="true">
      <directory suffix=".php">src</directory>
    </whitelist>
  </filter>
</phpunit>


================================================
FILE: skeleton/src/ServiceProvider.php.tpl
================================================
<?php echo "<?php\n"; ?>

namespace <?php echo $vendor; ?>\<?php echo $package; ?>;

class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
    const CONFIG_PATH = __DIR__ . '/../config/<?php echo $configFileName; ?>.php';

    public function boot()
    {
        $this->publishes([
            self::CONFIG_PATH => config_path('<?php echo $configFileName; ?>.php'),
        ], 'config');
    }

    public function register()
    {
        $this->mergeConfigFrom(
            self::CONFIG_PATH,
            '<?php echo $configFileName; ?>'
        );

        $this->app->bind('<?php echo $aliasName; ?>', function () {
            return new <?php echo $package; ?>();
        });
    }
}


================================================
FILE: src/Commands/PackageNew.php
================================================
<?php

namespace Melihovv\LaravelPackageGenerator\Commands;

use Exception;
use Illuminate\Console\Command;
use Melihovv\LaravelPackageGenerator\Commands\Traits\ChangesComposerJson;
use Melihovv\LaravelPackageGenerator\Commands\Traits\CopiesSkeleton;
use Melihovv\LaravelPackageGenerator\Commands\Traits\InteractsWithComposer;
use Melihovv\LaravelPackageGenerator\Commands\Traits\InteractsWithGit;
use Melihovv\LaravelPackageGenerator\Commands\Traits\ManipulatesPackageFolder;

class PackageNew extends Command
{
    use ChangesComposerJson;
    use ManipulatesPackageFolder;
    use InteractsWithComposer;
    use CopiesSkeleton;
    use InteractsWithGit;

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'package:new
                            {vendor : The vendor part of the namespace}
                            {package : The name of package for the namespace}
                            {--i|interactive : Interactive mode}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Create a new package.';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $vendor = $this->getVendor();
        $package = $this->getPackage();

        $vendorFolderName = $this->getVendorFolderName($vendor);
        $packageFolderName = $this->getPackageFolderName($package);

        $relPackagePath = "packages/$vendorFolderName/$packageFolderName";
        $packagePath = base_path($relPackagePath);

        try {
            $this->createPackageFolder($packagePath);
            $this->registerPackage($vendorFolderName, $packageFolderName, $relPackagePath);
            $this->copySkeleton($packagePath, $vendor, $package, $vendorFolderName, $packageFolderName);
            $this->initRepo($packagePath);
            $this->composerUpdatePackage($vendorFolderName, $packageFolderName);
            $this->composerDumpAutoload();

            $this->info('Finished. Are you ready to write awesome package?');

            return 0;
        } catch (Exception $e) {
            $this->error($e->getMessage());

            return -1;
        }
    }
}


================================================
FILE: src/Commands/PackageRemove.php
================================================
<?php

namespace Melihovv\LaravelPackageGenerator\Commands;

use Exception;
use Illuminate\Console\Command;
use Melihovv\LaravelPackageGenerator\Commands\Traits\ChangesComposerJson;
use Melihovv\LaravelPackageGenerator\Commands\Traits\InteractsWithComposer;
use Melihovv\LaravelPackageGenerator\Commands\Traits\InteractsWithUser;
use Melihovv\LaravelPackageGenerator\Commands\Traits\ManipulatesPackageFolder;

class PackageRemove extends Command
{
    use ChangesComposerJson;
    use ManipulatesPackageFolder;
    use InteractsWithUser;
    use InteractsWithComposer;

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'package:remove
                            {vendor : The vendor part of the namespace}
                            {package : The name of package for the namespace}
                            {--i|interactive : Interactive mode}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Remove the existing package.';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $vendor = $this->getVendor();
        $package = $this->getPackage();

        $vendorFolderName = $this->getVendorFolderName($vendor);
        $packageFolderName = $this->getPackageFolderName($package);

        $relPackagePath = "packages/$vendorFolderName/$packageFolderName";
        $packagePath = base_path($relPackagePath);

        try {
            $this->composerRemovePackage($vendorFolderName, $packageFolderName);
            $this->removePackageFolder($packagePath);
            $this->unregisterPackage($vendor, $package, "packages/$vendorFolderName/$packageFolderName");
            $this->composerDumpAutoload();

            return 0;
        } catch (Exception $e) {
            $this->error($e->getMessage());

            return -1;
        }
    }
}


================================================
FILE: src/Commands/Traits/ChangesComposerJson.php
================================================
<?php

namespace Melihovv\LaravelPackageGenerator\Commands\Traits;

use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\File;
use Melihovv\LaravelPackageGenerator\Exceptions\RuntimeException;

trait ChangesComposerJson
{
    /**
     * Register package in composer.json.
     *
     * @param $vendor
     * @param $package
     * @param $relPackagePath
     *
     * @throws RuntimeException
     */
    protected function registerPackage($vendor, $package, $relPackagePath)
    {
        $this->info('Register package in composer.json.');

        $composerJson = $this->loadComposerJson();

        if (! isset($composerJson['repositories'])) {
            Arr::set($composerJson, 'repositories', []);
        }

        $filtered = array_filter($composerJson['repositories'], function ($repository) use ($relPackagePath) {
            return $repository['type'] === 'path'
                && $repository['url'] === $relPackagePath;
        });

        if (count($filtered) === 0) {
            $this->info('Register composer repository for package.');

            $composerJson['repositories'][] = (object) [
                'type' => 'path',
                'url' => $relPackagePath,
            ];
        } else {
            $this->info('Composer repository for package is already registered.');
        }

        Arr::set($composerJson, "require.$vendor/$package", 'dev-master');

        $this->saveComposerJson($composerJson);

        $this->info('Package was successfully registered in composer.json.');
    }

    /**
     * Unregister package from composer.json.
     *
     * @param $vendor
     * @param $package
     *
     * @throws FileNotFoundException
     * @throws RuntimeException
     */
    protected function unregisterPackage($vendor, $package, $relPackagePath)
    {
        $this->info('Unregister package from composer.json.');

        $composerJson = $this->loadComposerJson();

        unset($composerJson['require']["$vendor\\$package\\"]);

        $repositories = array_filter($composerJson['repositories'], function ($repository) use ($relPackagePath) {
            return $repository['type'] !== 'path'
                || $repository['url'] !== $relPackagePath;
        });

        $composerJson['repositories'] = $repositories;

        if (count($composerJson['repositories']) === 0) {
            unset($composerJson['repositories']);
        }

        $this->saveComposerJson($composerJson);

        $this->info('Package was successfully unregistered from composer.json.');
    }

    /**
     * Load and parse content of composer.json.
     *
     * @return array
     *
     * @throws FileNotFoundException
     * @throws RuntimeException
     */
    protected function loadComposerJson()
    {
        $composerJsonPath = $this->getComposerJsonPath();

        if (! File::exists($composerJsonPath)) {
            throw new FileNotFoundException('composer.json does not exist');
        }

        $composerJsonContent = File::get($composerJsonPath);
        $composerJson = json_decode($composerJsonContent, true);

        if (! is_array($composerJson)) {
            throw new RuntimeException("Invalid composer.json file [$composerJsonPath]");
        }

        return $composerJson;
    }

    /**
     * @param array $composerJson
     *
     * @throws RuntimeException
     */
    protected function saveComposerJson($composerJson)
    {
        $newComposerJson = json_encode(
            $composerJson,
            JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES
        );

        $composerJsonPath = $this->getComposerJsonPath();
        if (File::put($composerJsonPath, $newComposerJson) === false) {
            throw new RuntimeException("Cannot write to composer.json [$composerJsonPath]");
        }
    }

    /**
     * Get composer.json path.
     *
     * @return string
     */
    protected function getComposerJsonPath()
    {
        return base_path('composer.json');
    }
}


================================================
FILE: src/Commands/Traits/CopiesSkeleton.php
================================================
<?php

namespace Melihovv\LaravelPackageGenerator\Commands\Traits;

use Exception;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use Illuminate\View\Engines\PhpEngine;
use Melihovv\LaravelPackageGenerator\Exceptions\RuntimeException;

trait CopiesSkeleton
{
    use InteractsWithUser;

    protected $packageBaseDir = __DIR__.'/../../..';

    /**
     * Copy skeleton to package folder.
     *
     * @param string $packagePath
     * @param string $vendor
     * @param string $package
     * @param string $vendorFolderName
     * @param string $packageFolderName
     *
     * @throws RuntimeException
     */
    protected function copySkeleton(
        $packagePath,
        $vendor,
        $package,
        $vendorFolderName,
        $packageFolderName
    ) {
        $this->info('Copy skeleton.');

        $skeletonDirPath = $this->getPathFromConfig(
            'skeleton_dir_path', $this->packageBaseDir.'/skeleton'
        );

        foreach (File::allFiles($skeletonDirPath, true) as $filePath) {
            $filePath = realpath($filePath);

            $destFilePath = Str::replaceFirst(
                $skeletonDirPath, $packagePath, $filePath
            );

            $this->copyFileWithDirsCreating($filePath, $destFilePath);
        }

        $this->copyStubs($packagePath, $package, $packageFolderName);

        $variables = $this->getVariables(
            $vendor, $package, $vendorFolderName, $packageFolderName
        );
        $this->replaceTemplates($packagePath, $variables);

        $this->info('Skeleton was successfully copied.');
    }

    /**
     * Copy stubs.
     *
     * @param $packagePath
     * @param $package
     * @param $packageFolderName
     */
    protected function copyStubs($packagePath, $package, $packageFolderName)
    {
        $facadeFilePath = $this->packageBaseDir.'/stubs/Facade.php.tpl';
        $mainClassFilePath = $this->packageBaseDir.'/stubs/MainClass.php.tpl';
        $mainClassTestFilePath = $this->packageBaseDir.'/stubs/MainClassTest.php.tpl';
        $configFilePath = $this->packageBaseDir.'/stubs/config.php';

        $filePaths = [
            $facadeFilePath => "$packagePath/src/Facades/$package.php.tpl",
            $mainClassFilePath => "$packagePath/src/$package.php.tpl",
            $mainClassTestFilePath => "$packagePath/tests/{$package}Test.php.tpl",
            $configFilePath => "$packagePath/config/$packageFolderName.php",
        ];

        foreach ($filePaths as $filePath => $destFilePath) {
            $this->copyFileWithDirsCreating($filePath, $destFilePath);
        }
    }

    /**
     * Substitute all variables in *.tpl files and remove tpl extension.
     *
     * @param string $packagePath
     * @param array $variables
     */
    protected function replaceTemplates($packagePath, $variables)
    {
        $phpEngine = app()->make(PhpEngine::class);

        foreach (File::allFiles($packagePath, true) as $filePath) {
            $filePath = realpath($filePath);

            if (! Str::endsWith($filePath, '.tpl')) {
                continue;
            }

            try {
                $newFileContent = $phpEngine->get($filePath, $variables);
            } catch (Exception $e) {
                $this->error("Template [$filePath] contains syntax errors");
                $this->error($e->getMessage());
                continue;
            }

            $filePathWithoutTplExt = Str::replaceLast(
                '.tpl', '', $filePath
            );

            File::put($filePathWithoutTplExt, $newFileContent);
            File::delete($filePath);
        }
    }

    /**
     * Copy source file to destination with needed directories creating.
     *
     * @param string $src
     * @param string $dest
     */
    protected function copyFileWithDirsCreating($src, $dest)
    {
        $dirPathOfDestFile = dirname($dest);

        if (! File::exists($dirPathOfDestFile)) {
            File::makeDirectory($dirPathOfDestFile, 0755, true);
        }

        if (! File::exists($dest)) {
            File::copy($src, $dest);
        }
    }

    /**
     * Get variables for substitution in templates.
     *
     * @param string $vendor
     * @param string $package
     * @param string $vendorFolderName
     * @param string $packageFolderName
     *
     * @return array
     */
    protected function getVariables(
        $vendor,
        $package,
        $vendorFolderName,
        $packageFolderName
    ) {
        $packageWords = str_replace('-', ' ', Str::snake($packageFolderName));

        $composerDescription = $this->askUser(
            'The composer description?', "A $packageWords"
        );
        $composerKeywords = $this->getComposerKeywords($packageWords);

        $packageHumanName = $this->askUser(
            'The package human name?', Str::title($packageWords)
        );

        return [
            'vendor' => $vendor,
            'package' => $package,
            'vendorFolderName' => $vendorFolderName,
            'packageFolderName' => $packageFolderName,
            'packageHumanName' => $packageHumanName,

            'composerName' => "$vendorFolderName/$packageFolderName",
            'composerDesc' => $composerDescription,
            'composerKeywords' => $composerKeywords,
            'license' => $this->askUser('The package licence?', 'MIT'),
            'phpVersion' => $this->askUser('Php version constraint?', '>=7.2'),

            'aliasName' => $packageFolderName,
            'configFileName' => $packageFolderName,

            'year' => date('Y'),

            'name' => $this->askUser('Your name?'),
            'email' => $this->askUser('Your email?'),
            'githubPackageUrl' => "https://github.com/$vendorFolderName/$packageFolderName",
        ];
    }

    /**
     * Get path from config.
     *
     * @param string $configName
     * @param string $default
     *
     * @return string
     *
     * @throws RuntimeException
     */
    protected function getPathFromConfig($configName, $default)
    {
        $path = config("package-generator.$configName");

        if (empty($path)) {
            $path = $default;
        } else {
            $path = base_path($path);
        }

        $realPath = realpath($path);

        if ($realPath === false) {
            throw RuntimeException::noAccessTo($path);
        }

        return $realPath;
    }

    /**
     * Get composer keywords.
     *
     * @param $packageWords
     *
     * @return string
     */
    protected function getComposerKeywords($packageWords)
    {
        $keywords = $this->askUser(
            'The composer keywords? (comma delimited)', str_replace(' ', ',', $packageWords)
        );
        $keywords = explode(',', $keywords);
        $keywords = array_map(function ($keyword) {
            return "\"$keyword\"";
        }, $keywords);

        return implode(",\n".str_repeat(' ', 4), $keywords);
    }
}


================================================
FILE: src/Commands/Traits/InteractsWithComposer.php
================================================
<?php

namespace Melihovv\LaravelPackageGenerator\Commands\Traits;

use Melihovv\LaravelPackageGenerator\Exceptions\RuntimeException;

trait InteractsWithComposer
{
    /**
     * Run "composer dump-autoload".
     */
    protected function composerDumpAutoload()
    {
        $this->composerRunCommand('composer dump-autoload');
    }

    /**
     * Run "composer update $vendor/$package".
     *
     * @param string $vendor
     * @param string $package
     */
    protected function composerUpdatePackage($vendor, $package)
    {
        $this->composerRunCommand("composer update --ignore-platform-reqs $vendor/$package");
    }

    /**
     * Run "composer remove $vendor/$package".
     *
     * @param string $vendor
     * @param string $package
     */
    protected function composerRemovePackage($vendor, $package)
    {
        $this->composerRunCommand("composer remove --ignore-platform-reqs $vendor/$package");
    }

    /**
     * Run arbitrary composer command.
     *
     * @param $command
     */
    protected function composerRunCommand($command)
    {
        $this->info("Run \"$command\".");

        $output = [];
        exec($command, $output, $returnStatusCode);

        if ($returnStatusCode !== 0) {
            throw RuntimeException::commandExecutionFailed($command, $returnStatusCode);
        }

        $this->info("\"$command\" was successfully ran.");
    }
}


================================================
FILE: src/Commands/Traits/InteractsWithGit.php
================================================
<?php

namespace Melihovv\LaravelPackageGenerator\Commands\Traits;

use Illuminate\Support\Facades\File;
use Melihovv\LaravelPackageGenerator\Exceptions\RuntimeException;

trait InteractsWithGit
{
    /**
     * Clone repo.
     *
     * @param $url
     * @param $dest
     * @param $branch
     *
     * @throws RuntimeException
     */
    protected function cloneRepo($url, $dest, $branch)
    {
        $command = "git clone --branch=$branch $url $dest";
        $this->info("Run \"$command\".");

        File::makeDirectory($dest, 0755, true);

        $output = [];
        exec($command, $output, $returnStatusCode);

        if ($returnStatusCode !== 0) {
            throw RuntimeException::commandExecutionFailed(
                $command, $returnStatusCode
            );
        }

        $this->info("\"$command\" was successfully ran.");
    }

    /**
     * Init git repo.
     * @param string $repoPath
     */
    protected function initRepo($repoPath)
    {
        $command = "git init $repoPath";
        $this->info("Run \"$command\".");

        $output = [];
        exec($command, $output, $returnStatusCode);

        if ($returnStatusCode !== 0) {
            throw RuntimeException::commandExecutionFailed(
                $command, $returnStatusCode
            );
        }

        $this->info("\"$command\" was successfully ran.");
    }
}


================================================
FILE: src/Commands/Traits/InteractsWithUser.php
================================================
<?php

namespace Melihovv\LaravelPackageGenerator\Commands\Traits;

use Illuminate\Support\Str;

trait InteractsWithUser
{
    /**
     * Get vendor part of the namespace part.
     *
     * @param string $default
     *
     * @return string
     */
    protected function getVendor($default = '')
    {
        $vendor = $this->argument('vendor') ?: $default;

        return $this->askUser('The vendor name?', $vendor);
    }

    /**
     * Get the name of package for the namespace.
     *
     * @param string $default
     *
     * @return string
     */
    protected function getPackage($default = '')
    {
        $package = $this->argument('package') ?: $default;

        return $this->askUser('The package name?', $package);
    }

    /**
     * Get vendor folder name.
     *
     * @param string $vendor
     *
     * @return string
     */
    protected function getVendorFolderName($vendor)
    {
        $vendorFolderName = Str::kebab($vendor);

        return $this->askUser('The vendor folder name?', $vendorFolderName);
    }

    /**
     * Get package folder name.
     *
     * @param string $package
     *
     * @return string
     */
    protected function getPackageFolderName($package)
    {
        $packageFolderName = Str::kebab($package);

        return $this->askUser('The package folder name?', $packageFolderName);
    }

    /**
     * Ask user.
     *
     * @param $question
     * @param $defaultValue
     *
     * @return string
     */
    protected function askUser($question, $defaultValue = '')
    {
        if ($this->option('interactive')) {
            return $this->ask($question, $defaultValue);
        }

        return $defaultValue;
    }
}


================================================
FILE: src/Commands/Traits/ManipulatesPackageFolder.php
================================================
<?php

namespace Melihovv\LaravelPackageGenerator\Commands\Traits;

use Illuminate\Support\Facades\File;
use Melihovv\LaravelPackageGenerator\Exceptions\RuntimeException;

trait ManipulatesPackageFolder
{
    /**
     * Create package folder.
     *
     * @param string $packagePath
     *
     * @throws RuntimeException
     */
    protected function createPackageFolder($packagePath)
    {
        $this->info('Create package folder.');

        if (File::exists($packagePath)) {
            $this->info('Package folder already exists. Skipping.');

            return;
        }

        if (! File::makeDirectory($packagePath, 0755, true)) {
            throw new RuntimeException('Cannot create package folder');
        }

        $this->info('Package folder was successfully created.');
    }

    /**
     * Remove package folder.
     *
     * @param $packagePath
     *
     * @throws RuntimeException
     */
    protected function removePackageFolder($packagePath)
    {
        $this->info('Remove package folder.');

        if (File::exists($packagePath)) {
            if (! File::deleteDirectory($packagePath)) {
                throw new RuntimeException('Cannot remove package folder');
            }

            $this->info('Package folder was successfully removed.');
        } else {
            $this->info('Package folder does not exists. Skipping.');
        }
    }
}


================================================
FILE: src/Exceptions/RuntimeException.php
================================================
<?php

namespace Melihovv\LaravelPackageGenerator\Exceptions;

class RuntimeException extends \RuntimeException
{
    /**
     * @param string $command
     * @param int $exitStatusCode
     * @param int $code
     * @param \Exception|\Throwable|null $previous
     * @return static
     */
    public static function commandExecutionFailed(
        $command,
        $exitStatusCode,
        $code = 0,
        $previous = null
    ) {
        $message = sprintf(
            "\"$command\" exited with %s status code",
            $exitStatusCode
        );

        return new static($message, $code, $previous);
    }

    /**
     * @param string $path
     * @param int $code
     * @param \Exception|\Throwable|null $previous
     * @return static
     */
    public static function noAccessTo(
        $path,
        $code = 0,
        $previous = null
    ) {
        return new static("No access to [$path]", $code, $previous);
    }
}


================================================
FILE: src/ServiceProvider.php
================================================
<?php

namespace Melihovv\LaravelPackageGenerator;

use Melihovv\LaravelPackageGenerator\Commands\PackageNew;
use Melihovv\LaravelPackageGenerator\Commands\PackageRemove;

class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
    const CONFIG_PATH = __DIR__.'/../config/package-generator.php';

    public function boot()
    {
        $this->publishes([
            self::CONFIG_PATH => config_path('package-generator.php'),
        ], 'config');

        if ($this->app->runningInConsole()) {
            $this->commands([
                PackageNew::class,
                PackageRemove::class,
            ]);
        }
    }

    public function register()
    {
        $this->mergeConfigFrom(
            self::CONFIG_PATH,
            'package-generator'
        );
    }
}


================================================
FILE: stubs/Facade.php.tpl
================================================
<?php echo "<?php\n"; ?>

namespace <?php echo $vendor; ?>\<?php echo $package; ?>\Facades;

use Illuminate\Support\Facades\Facade;

class <?php echo $package ?> extends Facade
{
    protected static function getFacadeAccessor()
    {
        return '<?php echo $aliasName; ?>';
    }
}


================================================
FILE: stubs/MainClass.php.tpl
================================================
<?php echo "<?php\n"; ?>

namespace <?php echo $vendor; ?>\<?php echo $package; ?>;

class <?php echo $package; ?>
{
}


================================================
FILE: stubs/MainClassTest.php.tpl
================================================
<?php echo "<?php\n"; ?>

namespace <?php echo $vendor; ?>\<?php echo $package; ?>\Tests;

use <?php echo $vendor; ?>\<?php echo $package; ?>\Facades\<?php echo $package; ?>;
use <?php echo $vendor; ?>\<?php echo $package; ?>\ServiceProvider;
use Orchestra\Testbench\TestCase;

class <?php echo $package; ?>Test extends TestCase
{
    protected function getPackageProviders($app)
    {
        return [ServiceProvider::class];
    }

    protected function getPackageAliases($app)
    {
        return [
            '<?php echo $aliasName; ?>' => <?php echo $package; ?>::class,
        ];
    }

    public function testExample()
    {
        $this->assertEquals(1, 1);
    }
}


================================================
FILE: stubs/config.php
================================================
<?php

return [

];
Download .txt
gitextract_wkweo582/

├── .editorconfig
├── .gitattributes
├── .github/
│   └── workflows/
│       └── default.yml
├── .gitignore
├── .styleci.yml
├── LICENSE
├── README.md
├── composer.json
├── config/
│   └── package-generator.php
├── skeleton/
│   ├── .editorconfig
│   ├── .gitattributes.tpl
│   ├── .github/
│   │   └── workflows/
│   │       └── default.yml
│   ├── .gitignore.tpl
│   ├── .styleci.yml
│   ├── LICENSE.tpl
│   ├── README.md.tpl
│   ├── composer.json.tpl
│   ├── phpunit.xml
│   └── src/
│       └── ServiceProvider.php.tpl
├── src/
│   ├── Commands/
│   │   ├── PackageNew.php
│   │   ├── PackageRemove.php
│   │   └── Traits/
│   │       ├── ChangesComposerJson.php
│   │       ├── CopiesSkeleton.php
│   │       ├── InteractsWithComposer.php
│   │       ├── InteractsWithGit.php
│   │       ├── InteractsWithUser.php
│   │       └── ManipulatesPackageFolder.php
│   ├── Exceptions/
│   │   └── RuntimeException.php
│   └── ServiceProvider.php
└── stubs/
    ├── Facade.php.tpl
    ├── MainClass.php.tpl
    ├── MainClassTest.php.tpl
    └── config.php
Download .txt
SYMBOL INDEX (41 symbols across 10 files)

FILE: src/Commands/PackageNew.php
  class PackageNew (line 13) | class PackageNew extends Command
    method handle (line 43) | public function handle()

FILE: src/Commands/PackageRemove.php
  class PackageRemove (line 12) | class PackageRemove extends Command
    method handle (line 41) | public function handle()

FILE: src/Commands/Traits/ChangesComposerJson.php
  type ChangesComposerJson (line 10) | trait ChangesComposerJson
    method registerPackage (line 21) | protected function registerPackage($vendor, $package, $relPackagePath)
    method unregisterPackage (line 63) | protected function unregisterPackage($vendor, $package, $relPackagePath)
    method loadComposerJson (line 95) | protected function loadComposerJson()
    method saveComposerJson (line 118) | protected function saveComposerJson($composerJson)
    method getComposerJsonPath (line 136) | protected function getComposerJsonPath()

FILE: src/Commands/Traits/CopiesSkeleton.php
  type CopiesSkeleton (line 11) | trait CopiesSkeleton
    method copySkeleton (line 28) | protected function copySkeleton(
    method copyStubs (line 68) | protected function copyStubs($packagePath, $package, $packageFolderName)
    method replaceTemplates (line 93) | protected function replaceTemplates($packagePath, $variables)
    method copyFileWithDirsCreating (line 127) | protected function copyFileWithDirsCreating($src, $dest)
    method getVariables (line 150) | protected function getVariables(
    method getPathFromConfig (line 201) | protected function getPathFromConfig($configName, $default)
    method getComposerKeywords (line 227) | protected function getComposerKeywords($packageWords)

FILE: src/Commands/Traits/InteractsWithComposer.php
  type InteractsWithComposer (line 7) | trait InteractsWithComposer
    method composerDumpAutoload (line 12) | protected function composerDumpAutoload()
    method composerUpdatePackage (line 23) | protected function composerUpdatePackage($vendor, $package)
    method composerRemovePackage (line 34) | protected function composerRemovePackage($vendor, $package)
    method composerRunCommand (line 44) | protected function composerRunCommand($command)

FILE: src/Commands/Traits/InteractsWithGit.php
  type InteractsWithGit (line 8) | trait InteractsWithGit
    method cloneRepo (line 19) | protected function cloneRepo($url, $dest, $branch)
    method initRepo (line 42) | protected function initRepo($repoPath)

FILE: src/Commands/Traits/InteractsWithUser.php
  type InteractsWithUser (line 7) | trait InteractsWithUser
    method getVendor (line 16) | protected function getVendor($default = '')
    method getPackage (line 30) | protected function getPackage($default = '')
    method getVendorFolderName (line 44) | protected function getVendorFolderName($vendor)
    method getPackageFolderName (line 58) | protected function getPackageFolderName($package)
    method askUser (line 73) | protected function askUser($question, $defaultValue = '')

FILE: src/Commands/Traits/ManipulatesPackageFolder.php
  type ManipulatesPackageFolder (line 8) | trait ManipulatesPackageFolder
    method createPackageFolder (line 17) | protected function createPackageFolder($packagePath)
    method removePackageFolder (line 41) | protected function removePackageFolder($packagePath)

FILE: src/Exceptions/RuntimeException.php
  class RuntimeException (line 5) | class RuntimeException extends \RuntimeException
    method commandExecutionFailed (line 14) | public static function commandExecutionFailed(
    method noAccessTo (line 34) | public static function noAccessTo(

FILE: src/ServiceProvider.php
  class ServiceProvider (line 8) | class ServiceProvider extends \Illuminate\Support\ServiceProvider
    method boot (line 12) | public function boot()
    method register (line 26) | public function register()
Condensed preview — 33 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (43K chars).
[
  {
    "path": ".editorconfig",
    "chars": 203,
    "preview": "root = true\n\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ni"
  },
  {
    "path": ".gitattributes",
    "chars": 376,
    "preview": "* text=auto\n/.github export-ignore\n/tests export-ignore\n/.editorconfig export-ignore\n/.gitattributes export-ignore\n/.git"
  },
  {
    "path": ".github/workflows/default.yml",
    "chars": 1306,
    "preview": "name: Run tests\n\non:\n  push:\n  schedule:\n    - cron: '0 0 * * *'\n\njobs:\n  php-tests:\n    runs-on: ${{ matrix.os }}\n\n    "
  },
  {
    "path": ".gitignore",
    "chars": 68,
    "preview": "/vendor\n/.idea/\n/node_modules\n/composer.lock\n/.phpunit.result.cache\n"
  },
  {
    "path": ".styleci.yml",
    "chars": 16,
    "preview": "preset: laravel\n"
  },
  {
    "path": "LICENSE",
    "chars": 1103,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2016 Alexander Melihov <amelihovv@ya.ru>\n\nPermission is hereby granted, free of cha"
  },
  {
    "path": "README.md",
    "chars": 3514,
    "preview": "Laravel package generator\n=========================\n\n[![GitHub Workflow Status](https://github.com/melihovv/laravel-pack"
  },
  {
    "path": "composer.json",
    "chars": 903,
    "preview": "{\n  \"name\": \"melihovv/laravel-package-generator\",\n  \"description\": \"A laravel package generator\",\n  \"license\": \"MIT\",\n  "
  },
  {
    "path": "config/package-generator.php",
    "chars": 404,
    "preview": "<?php\n\nreturn [\n\n    /*\n    |--------------------------------------------------------------------------\n    | Custom ske"
  },
  {
    "path": "skeleton/.editorconfig",
    "chars": 203,
    "preview": "root = true\n\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ni"
  },
  {
    "path": "skeleton/.gitattributes.tpl",
    "chars": 376,
    "preview": "* text=auto\n/.github export-ignore\n/tests export-ignore\n/.editorconfig export-ignore\n/.gitattributes export-ignore\n/.git"
  },
  {
    "path": "skeleton/.github/workflows/default.yml",
    "chars": 1364,
    "preview": "name: Run tests\n\non:\n  push:\n  schedule:\n    - cron: '0 0 * * *'\n\njobs:\n  php-tests:\n    runs-on: ${{ matrix.os }}\n\n    "
  },
  {
    "path": "skeleton/.gitignore.tpl",
    "chars": 67,
    "preview": "/vendor\n/.idea\n/node_modules\n/composer.lock\n/.phpunit.result.cache\n"
  },
  {
    "path": "skeleton/.styleci.yml",
    "chars": 16,
    "preview": "preset: laravel\n"
  },
  {
    "path": "skeleton/LICENSE.tpl",
    "chars": 1128,
    "preview": "The MIT License (MIT)\n\nCopyright (c) <?php echo $year; ?> <?php echo $name; ?> <<?php echo $email; ?>>\n\nPermission is he"
  },
  {
    "path": "skeleton/README.md.tpl",
    "chars": 1789,
    "preview": "# <?php echo \"$packageHumanName\\n\"; ?>\n\n[![GitHub Workflow Status](https://github.com/<?php echo $vendorFolderName; ?>/<"
  },
  {
    "path": "skeleton/composer.json.tpl",
    "chars": 1062,
    "preview": "{\n  \"name\": \"<?php echo $composerName; ?>\",\n  \"description\": \"<?php echo $composerDesc; ?>\",\n  \"license\": \"<?php echo $l"
  },
  {
    "path": "skeleton/phpunit.xml",
    "chars": 657,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<phpunit backupGlobals=\"false\"\n         backupStaticAttributes=\"false\"\n         b"
  },
  {
    "path": "skeleton/src/ServiceProvider.php.tpl",
    "chars": 705,
    "preview": "<?php echo \"<?php\\n\"; ?>\n\nnamespace <?php echo $vendor; ?>\\<?php echo $package; ?>;\n\nclass ServiceProvider extends \\Illu"
  },
  {
    "path": "src/Commands/PackageNew.php",
    "chars": 2257,
    "preview": "<?php\n\nnamespace Melihovv\\LaravelPackageGenerator\\Commands;\n\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Melihovv"
  },
  {
    "path": "src/Commands/PackageRemove.php",
    "chars": 1966,
    "preview": "<?php\n\nnamespace Melihovv\\LaravelPackageGenerator\\Commands;\n\nuse Exception;\nuse Illuminate\\Console\\Command;\nuse Melihovv"
  },
  {
    "path": "src/Commands/Traits/ChangesComposerJson.php",
    "chars": 4016,
    "preview": "<?php\n\nnamespace Melihovv\\LaravelPackageGenerator\\Commands\\Traits;\n\nuse Illuminate\\Contracts\\Filesystem\\FileNotFoundExce"
  },
  {
    "path": "src/Commands/Traits/CopiesSkeleton.php",
    "chars": 6941,
    "preview": "<?php\n\nnamespace Melihovv\\LaravelPackageGenerator\\Commands\\Traits;\n\nuse Exception;\nuse Illuminate\\Support\\Facades\\File;\n"
  },
  {
    "path": "src/Commands/Traits/InteractsWithComposer.php",
    "chars": 1405,
    "preview": "<?php\n\nnamespace Melihovv\\LaravelPackageGenerator\\Commands\\Traits;\n\nuse Melihovv\\LaravelPackageGenerator\\Exceptions\\Runt"
  },
  {
    "path": "src/Commands/Traits/InteractsWithGit.php",
    "chars": 1375,
    "preview": "<?php\n\nnamespace Melihovv\\LaravelPackageGenerator\\Commands\\Traits;\n\nuse Illuminate\\Support\\Facades\\File;\nuse Melihovv\\La"
  },
  {
    "path": "src/Commands/Traits/InteractsWithUser.php",
    "chars": 1701,
    "preview": "<?php\n\nnamespace Melihovv\\LaravelPackageGenerator\\Commands\\Traits;\n\nuse Illuminate\\Support\\Str;\n\ntrait InteractsWithUser"
  },
  {
    "path": "src/Commands/Traits/ManipulatesPackageFolder.php",
    "chars": 1397,
    "preview": "<?php\n\nnamespace Melihovv\\LaravelPackageGenerator\\Commands\\Traits;\n\nuse Illuminate\\Support\\Facades\\File;\nuse Melihovv\\La"
  },
  {
    "path": "src/Exceptions/RuntimeException.php",
    "chars": 945,
    "preview": "<?php\n\nnamespace Melihovv\\LaravelPackageGenerator\\Exceptions;\n\nclass RuntimeException extends \\RuntimeException\n{\n    /*"
  },
  {
    "path": "src/ServiceProvider.php",
    "chars": 796,
    "preview": "<?php\n\nnamespace Melihovv\\LaravelPackageGenerator;\n\nuse Melihovv\\LaravelPackageGenerator\\Commands\\PackageNew;\nuse Meliho"
  },
  {
    "path": "stubs/Facade.php.tpl",
    "chars": 287,
    "preview": "<?php echo \"<?php\\n\"; ?>\n\nnamespace <?php echo $vendor; ?>\\<?php echo $package; ?>\\Facades;\n\nuse Illuminate\\Support\\Faca"
  },
  {
    "path": "stubs/MainClass.php.tpl",
    "chars": 119,
    "preview": "<?php echo \"<?php\\n\"; ?>\n\nnamespace <?php echo $vendor; ?>\\<?php echo $package; ?>;\n\nclass <?php echo $package; ?>\n{\n}\n"
  },
  {
    "path": "stubs/MainClassTest.php.tpl",
    "chars": 680,
    "preview": "<?php echo \"<?php\\n\"; ?>\n\nnamespace <?php echo $vendor; ?>\\<?php echo $package; ?>\\Tests;\n\nuse <?php echo $vendor; ?>\\<?"
  },
  {
    "path": "stubs/config.php",
    "chars": 20,
    "preview": "<?php\n\nreturn [\n\n];\n"
  }
]

About this extraction

This page contains the full source code of the melihovv/laravel-package-generator GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 33 files (38.2 KB), approximately 10.4k tokens, and a symbol index with 41 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!