flipboxstudio / lumen-generator

A Lumen Generator You Are Missing
https://packagist.org/packages/flipbox/lumen-generator
MIT License
822 stars 126 forks source link

Could you release your latest version for 6.0 support? #57

Closed tychovbh closed 4 years ago

joelhy commented 4 years ago

@krisanalfa Please update packagist package.

kakposoe commented 4 years ago

@joelhy Tag 6.0 doesn't seem to have been added on packagist. Latest is 5.6.10 (as of time of writing).

Slubby commented 4 years ago

@joelhy Can you also update the composer to 6.0? I can only download 5.6.10.

joelhy commented 4 years ago

@krisanalfa is in charge of flipboxstudio/lumen-generator's packagist account, I do not have privilege.

For now, please use develop branch by adding following code to your composer.json:

    "repositories": [
        {
            "type": "git",
            "url": "git@github.com:flipboxstudio/lumen-generator.git"
        },
    ]
    "require": {
        "flipbox/lumen-generator": "dev-develop",
        // .......   your other packages here
    },

Then run composer install

fabiankaimer commented 4 years ago

I installed lumen-generator as explained above (version 6.0 on a fresh installation of Lumen 6.0) but keep getting the error "Call to undefined function Flipbox\LumenGenerator\Console\str_replace_first()" when I try to run any "make:xyz" function.

After a little bit of research I found that "str_replace_first()" is a helper function from laravel that's not available on Lumen's "helpers.php" but is called in "GeneratorCommand.php"'s "getPath()" function (and in "TestMakeCommand.php", too btw).

image

Could you please provide a fix for this? Anyways, great tool :)

fabiankaimer commented 4 years ago

A quick-and-dirty fix was to edit the "helpers.php" file in "vendor/laravel/lumen-framework/src" and to add string support at the top:

use Illuminate\Support\Str;

and add the "str_replace_first()" function manually:

if (! function_exists('str_replace_first')) {
    /**
     * Replace the first occurrence of a given value in the string.
     *
     * @param  string  $search
     * @param  string  $replace
     * @param  string  $subject
     * @return string
     */
     function str_replace_first($search, $replace, $subject)
     {
        return Str::replaceFirst($search, $replace, $subject);
     }
}