Code Monkey home page Code Monkey logo

laravel-zero's Introduction

Laravel Zero Logo

Build Status Total Downloads Latest Stable Version License

Laravel Zero was created by Nuno Maduro and Owen Voke, and is a micro-framework that provides an elegant starting point for your console application. It is an unofficial and customized version of Laravel optimized for building command-line applications.


Documentation

For full documentation, visit laravel-zero.com.

Support the development

Do you like this project? Support it by donating

License

Laravel Zero is an open-source software licensed under the MIT license.

laravel-zero's People

Contributors

bogardo avatar browner12 avatar carusogabriel avatar clarkeash avatar dbpolito avatar geoffroy-aubry avatar ijpatricio avatar ilesinge avatar introwit avatar jbrooksuk avatar joaorobertopb avatar matt-allan avatar nathangiesbrecht avatar nunomaduro avatar owenvoke avatar rennokki avatar scrutinizer-auto-fixer avatar sergiy-petrov avatar sertxudev avatar simonardejr avatar spekulatius avatar spenserhale avatar stefanzweifel avatar stylecibot avatar supianidz avatar vojtasvoboda avatar xico2k 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  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  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

laravel-zero's Issues

[Question] Any recommended way to deal with user configs?

Hi, I was just wondering if there is any recommended way to deal with user configs for the user to store mysql credentials etc.

edit: I was trying to use .env but it seems like the application cant find the file once builded.

Great project so far!

Kind regards,
Kristoffer

Build fails when `app.production` => true

When I attempt to build my cli app with the production property set to true the build is not able to run and I get an error saying that the app namespace has no commands registered.

[Symfony\Component\Console\Exception\CommandNotFoundException]  
There are no commands defined in the "app" namespace.    

Am I doing something wrong?

[5.7] Make some core packages optional

Good day! First I want to say thank you very much for the excellent framework, I use it now to create a console application. Is it possible to move all noncritical dependencies from the framework to the application skeleton? Like: "nunomaduro/laravel-console-menu":"1.0.*" . Console menu not working on Windows due to the fact that POSIX will not install on Windows. And it would be nice to make the option of choosing these dependencies in final app. I am also using symfony/filesystem instead of league/flysystem because I need the absolute path to the file.

database setup

Hi I'm sorry if this is documented somewhere but I can't see it - I've only just started playing with laravel-zero, I installed database components, however the database config file is quite bare - is there any direction as to where/what connection details (user/pass etc) are required to connect to a mysql db ?

Build Error

when i run this command

php application build zonda

getting below fatal error

system config

  • PHP 7.0
  • OS Ubuntu
  • Webserver : APACHE 2
PHP Fatal error:  Uncaught TypeError: Return value of App\Console\Commands\Build::configure() must be an instance of App\Console\Commands\void, none returned in /var/www/html/dev/zero/app/Console/Commands/Build.php:57
Stack trace:
#0 /var/www/html/dev/zero/vendor/symfony/console/Command/Command.php(63): App\Console\Commands\Build->configure()
#1 /var/www/html/dev/zero/vendor/illuminate/console/Command.php(124): Symfony\Component\Console\Command\Command->__construct('build')
#2 /var/www/html/dev/zero/vendor/illuminate/console/Command.php(98): Illuminate\Console\Command->configureUsingFluentDefinition()
#3 /var/www/html/dev/zero/app/Console/Application.php(86): Illuminate\Console\Command->__construct()
#4 /var/www/html/dev/zero/app/Console/Application.php(69): App\Console\Application->registerBaseCommands()
#5 /var/www/html/dev/zero/bootstrap/app.php(20): App\Console\Application->__construct(Object(Illuminate\Container\Container), Object(Illuminate\Events\Dispatcher))
#6 /var/www/html/dev/zero/bootstrap/init.php(17): require_onc in /var/www/html/dev/zero/app/Console/Commands/Build.php on line 57

Using database and storage in build not working

I wrote a small local console app that uses a database and storage (downloads).
The app runs perfect except as a standalone build, then the database and storage are not found.

Illuminate\Database\QueryException : Database (phar:///Users/dimitri/ConsoleApp/builds/application/config/../../database/database.sqlite) does not exist.

Is it possible to create a standalone build with database and storage?

Distributing built project via composer

Hi ๐Ÿ™‚ I'm intrigued by this project, but I have a question. Can I distribute my built project via composer/packagist? So people could do composer global require vendor/my-zero-project?

I couldn't find anything about this in the docs, and AFAIK the bin option in a composer.json doesn't support .phar files, so I won't be able to use that.

Thanks in advance!

Command not defined

Hello!
i can't run the "Hello" command in a fresh package instalation.

[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "hello" is not defined.

I've created a new command and happens the same thing.

Somebody can help me?

[4.0.9] Built application seems corrupted

Hi !

I've just updated to the last framework version (4.0.9) and the built binary doesn't work.

Here's what I have when I launch it:

PHP Fatal error:  Uncaught PharException: in phar "/Users/martylamoureux/zero/builds/application", manifest claims to have zero entries.  Phars must have at least 1 entry in /Users/martylamoureux/zero/builds/application:9
Stack trace:
#0 /Users/martylamoureux/zero/builds/application9): Phar::webPhar(NULL, 'index.php')
#1 {main}
  thrown in /Users/martylamoureux/zero/builds/application on line 9

Fatal error: Uncaught PharException: in phar "/Users/martylamoureux/zero/builds/application", manifest claims to have zero entries.  Phars must have at least 1 entry in /Users/martylamoureux/zero/builds/application:9
Stack trace:
#0 /Users/martylamoureux/zero/builds/application(9): Phar::webPhar(NULL, 'index.php')
#1 {main}
  thrown in /Users/martylamoureux/zero/builds/application on line 9

I've just tested out with a fresh install, got the same :

$ composer create-project --prefer-dist laravel-zero/laravel-zero test-zero
$ php test-zero app:build
$ php builds/application

Thanks for the great work you made for this project ๐Ÿ‘

[Question] How to pass short options (ie -d)

I am able to use normal options --name just fine, however, trying to configure how to use short options -d but it throws

                                    
  The "--d" option does not exist.  
                                    

Using the following signature

    protected $signature = 'app:start {-d:debug, --d= :debug, --v= :verbose, --i= :interactive}';
$ ./cli app:start -d

.env not working?

Hello!

I set a APP_ENV in my .env created in project root, and this always returns null.

dd(env('APP_ENV'));

Someone can reproduce this?

[Question] How to pass all command line parameters

Assuming I have the following

$ cli app:start -d -v -q

or

$ cli app:start -dvq

How can I setup the command to pass along the command line options

    ... signature ...
    protected $signature = 'app:start {-d: debug, -v: verbose, -q: quiet}';

Builded file not work (search for init.php)

โžœ php zonda build zonda

Building: zonda
Standalone application compiled into: builds/zonda

โžœ php builds\zonda

Warning: include(phar://D:\code\test\laravel-zero-test\builds\zonda/bootstrap/init.php): failed to open stream: phar error: "bootstrap/init.php" is not a file in phar "D:/code/test/laravel-zero-test/builds/zonda" in D:\code\test\laravel-zero-test\builds\zonda on line 9

Call Stack:
    0.0116     429272   1. {main}() D:\code\test\laravel-zero-test\builds\zonda:0

Warning: include(): Failed opening 'phar://D:\code\test\laravel-zero-test\builds\zonda/bootstrap/init.php' for inclusion (include_path='phar://D:\code\test\laravel-zero-test\builds\zonda;.;C:/laragon/etc/php/pear') in D:\code\test\laravel-zero-test\builds\zonda on line 9

Call Stack:
    0.0116     429272   1. {main}() D:\code\test\laravel-zero-test\builds\zonda:0

โžœ php -v

PHP 7.1.5 (cli) (built: May  9 2017 19:49:10) ( ZTS MSVC14 (Visual C++ 2015) x64 )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Xdebug v2.5.4, Copyright (c) 2002-2017, by Derick Rethans

I find a reference for init.php in Build.php but no idea how fix it.

Cannot install

Whenever i try to install

โžœ  hello composer global require laravel-zero/installer
Changed current directory to /Users/shirshak/.composer
Using version ^1.1 for laravel-zero/installer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install laravel-zero/installer v1.1.7
    - Conclusion: don't install laravel-zero/installer v1.1.6
    - Conclusion: don't install laravel-zero/installer v1.1.5
    - Conclusion: don't install laravel-zero/installer v1.1.4
    - Conclusion: don't install laravel-zero/installer v1.1.3
    - Conclusion: don't install laravel-zero/installer v1.1.2
    - Conclusion: don't install laravel-zero/installer v1.1.1
    - Conclusion: remove symfony/console v4.0.2
    - Installation request for laravel-zero/installer ^1.1 -> satisfiable by laravel-zero/installer[v1.1.0, v1.1.1, v1.1.2, v1.1.3, v1.1.4, v1.1.5, v1.1.6, v1.1.7].
    - Conclusion: don't install symfony/console v4.0.2
    - laravel-zero/installer v1.1.0 requires laravel-zero/framework ~3.6 -> satisfiable by laravel-zero/framework[v3.10.0, v3.6.0, v3.6.1, v3.6.10, v3.6.11, v3.6.12, v3.6.2, v3.6.3, v3.6.4, v3.6.5, v3.7.0, v3.7.1, v3.7.2, v3.8.0, v3.8.1, v3.8.2, v3.9.0, v3.9.1, v3.9.2].
    - laravel-zero/framework v3.10.0 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.6.0 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.6.1 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.6.10 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.6.11 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.6.12 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.6.2 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.6.3 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.6.4 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.6.5 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.7.0 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.7.1 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.7.2 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.8.0 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.8.1 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.8.2 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.9.0 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.9.1 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - laravel-zero/framework v3.9.2 requires illuminate/console 5.5.* -> satisfiable by illuminate/console[v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28].
    - illuminate/console v5.5.0 requires symfony/console ~3.3 -> satisfiable by symfony/console[v3.3.0, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.1, v3.4.2].
    - illuminate/console v5.5.16 requires symfony/console ~3.3 -> satisfiable by symfony/console[v3.3.0, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.1, v3.4.2].
    - illuminate/console v5.5.17 requires symfony/console ~3.3 -> satisfiable by symfony/console[v3.3.0, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.1, v3.4.2].
    - illuminate/console v5.5.2 requires symfony/console ~3.3 -> satisfiable by symfony/console[v3.3.0, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.1, v3.4.2].
    - illuminate/console v5.5.28 requires symfony/console ~3.3 -> satisfiable by symfony/console[v3.3.0, v3.3.1, v3.3.10, v3.3.11, v3.3.12, v3.3.13, v3.3.14, v3.3.2, v3.3.3, v3.3.4, v3.3.5, v3.3.6, v3.3.7, v3.3.8, v3.3.9, v3.4.0, v3.4.1, v3.4.2].
    - Can only install one of: symfony/console[v3.3.0, v4.0.2].
    - Can only install one of: symfony/console[v3.3.1, v4.0.2].
    - Can only install one of: symfony/console[v3.3.10, v4.0.2].
    - Can only install one of: symfony/console[v3.3.11, v4.0.2].
    - Can only install one of: symfony/console[v3.3.12, v4.0.2].
    - Can only install one of: symfony/console[v3.3.13, v4.0.2].
    - Can only install one of: symfony/console[v3.3.14, v4.0.2].
    - Can only install one of: symfony/console[v3.3.2, v4.0.2].
    - Can only install one of: symfony/console[v3.3.3, v4.0.2].
    - Can only install one of: symfony/console[v3.3.4, v4.0.2].
    - Can only install one of: symfony/console[v3.3.5, v4.0.2].
    - Can only install one of: symfony/console[v3.3.6, v4.0.2].
    - Can only install one of: symfony/console[v3.3.7, v4.0.2].
    - Can only install one of: symfony/console[v3.3.8, v4.0.2].
    - Can only install one of: symfony/console[v3.3.9, v4.0.2].
    - Can only install one of: symfony/console[v3.4.0, v4.0.2].
    - Can only install one of: symfony/console[v3.4.1, v4.0.2].
    - Can only install one of: symfony/console[v3.4.2, v4.0.2].
    - Installation request for symfony/console (locked at v4.0.2) -> satisfiable by symfony/console[v4.0.2].


Installation failed, reverting ./composer.json to its original content.

Add option to remove own development commands

Hi,
Thanks for your amazing job on LZ. I use your app to automate everything on my servers. I use to use bash but it's so much better with the addition of PHP.
I wanted to know if you can add an option to commands config file to hide my custom dev commands only on production.
Like the 'hidden' field but which remove commands on production.
Thanks you.

Remove unnecessary files when build

It's size is 8M after build(empty project).
Although storage space is negligible in this day and age.
But i still think the smaller the better, and what do u think?

Update to version 4.0.22/4.0.23 breaks app

When I run:

composer update laravel-zero/framework

and then try to run my app, I get the following error:

ReflectionException  : Class LaravelZero\Framework\Commands\Component\Vlucas\Phpdotenv\Installer does not exist

I have cleared the composer cache, and ran composer du. I even deleted my vendor directory and composer.lock file before running composer update but still get the above error.

[Proposal] Add tool to launch a browser

RFC: tool to launch a browser window. It might look like one of:

$browser->open($url);
$lz->openBrowser($url);

In its simplest form it'd call the likes of:

// Linux
xdg-open "$url"

// macOS
open "$url"

// Windows
start "$url"

A few potential features:

  • Allow defining full paths to browsers on the system (e.g., 'firefox' => '/usr/bin/firefox')
  • Implement browser discovery on the system (e.g., find path to firefox, safari, chrome, ...)
  • If browser discovery works then allow either:
    • require a specific browser (e.g., only use firefox)
    • prefer a specific browser (e.g., use firefox if you find it, else use the default)

I'm not sure if this belongs in Laravel Zero or as its own package but am posting this desire here as Laravel Zero is the future of CLI programming :) All feedback is welcome.

The build feature is broken

Version: 1.1.4
PHP Version: 7.1.2

Description:

After adding the feature "Adds compatibility with Laravel Services Providers" the build feature is broken. The main cause is the new following line on the Application.php:

        $this->container->instance('config', new Repository(
            require BASE_PATH . '/' . 'config/config.php'
        ));

Since now there is a require on the code, the following error appears on the usage of the Phar:

PHP Warning: require(phar:///Users/nunomaduro/Projects/laravel-zero/builds/test2/config/config.php): failed to open stream: phar error: "config/config.php"

Steps To Reproduce:

  1. Create a new Laravel Zero Project:

composer create-project --prefer-dist nunomaduro/laravel-zero application

  1. Create a build of your project:

php application build

  1. Execute your build:

php builds/application

Filesystem path on documentation seems to be wrong

Hey.
In the official docs, its stated: Note: The root directory is your-app-name/storage/local
With a fresh install, actually the path that is being used is your-app-name/storage/app.
Cheers, and thanks for the great work

Replacing IOC bindings in tests doesn't work

I'm having some issues while trying to replace IOC bindings with my own (mocked) versions in tests. This is my situation:

I have a TestService.php with one method in it (someMethod) that just returns a string to signify it's coming from the actual (non-mocked) version of the class: https://github.com/svenluijten/laravel-zero-ioc-test/blob/master/app/TestService.php.

This service is injected in the container in the AppServiceProvider without anything special.

In the HelloCommand class I'm injecting that service into the container and dumping the result of ->someMethod() in the handle method. Pretty straight forward, right?

In my test, all I'm doing is creating a mock of that service and configuring it so that ->someMethod() returns from tests to indicate that it's the mocked version that we're using.

That mock is then injected into the service container using app()->instance(...);, after which the command that has the service injected into it is called.

I would expect the dumped result to be from tests, because it would have grabbed the mock from the service container instead of the "standard" implementation (registered via the AppServiceProvider).

Instead, I get the result from the actual class!! I honestly have no idea where to even begin looking with this issue ๐Ÿ˜–

Scheduler commands order

Is there any way of defining the cron command order? For example, having two commands running every minute, define which one is going to be executed first.

How to test that proper parameters have been passed

When creating tests which call the various commands, how do I supply 'mock' arguments or options to make sure they are valid

        $this->app->call((new DatabaseInfoCommand())->getName());

This will not contain the name argument (for obvious reasons, it is not passed)

[Proposal] Modify output behavior; optional newlines and icons

Applications are finding different ways to insert newlines into messages. The two ways I've seen thus far in real-world Laravel Zero apps:

$this->error("\nFoo\n");
$this->line('');
$this->error('Foo');
$this->line('');

Neither approach seems ideal. Could there be a better way? The following feels right:

$this->error('Foo');

Related and while we're here, what if we could also (optionally) enable icons for these? For example, maybe info() could be configured to prepend (i) or similar so these stand out a little more. For my use case, app output includes stdout from Process commands so prepending icons to Laravel Zero output could make it stand out a bit.

All thoughts and idea improvements are welcome :)

Unable to get optional parameters working

I am trying to get alternate parameters working, but not having much luck

Here is the desired signature

protected $signature = 'database:build {name} {--tables=}';

And the snippet from handle method

        $db = $this->argument('name');
        $tables = $this->argument('tables');

        $this->info("Build ${db} Database");

Produces following error

โฏ php m4-tools database:build sotg_www --tables=one

   Symfony\Component\Console\Exception\RuntimeException  : The "--tables" option does not accept a value.

  at /Users/merickson/docker/localenv/m4-tools/vendor/symfony/console/Input/ArgvInput.php: 228
  224:
  225:         $option = $this->definition->getOption($name);
  226:
  227:         if (null !== $value && !$option->acceptValue()) {
  228:             throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  229:         }
  230:
  231:         if (in_array($value, array('', null), true) && $option->acceptValue() && count($this->parsed)) {
  232:             // if option accepts an optional or mandatory argument
  233:             // let's see if there is one provided

  Exception trace:

  1   Symfony\Component\Console\Input\ArgvInput::addLongOption("tables", "one")
      /Users/merickson/docker/localenv/m4-tools/vendor/symfony/console/Input/ArgvInput.php : 156

  2   Symfony\Component\Console\Input\ArgvInput::parseLongOption("--tables=one")
      /Users/merickson/docker/localenv/m4-tools/vendor/symfony/console/Input/ArgvInput.php : 82

[Proposal] Helper for platform detection

An action's definition may depend on the platform. For example, issue #95 launches a browser window and must know the platform / operating system.

Laravel Zero might require a package for this or offer something simpler as, in theory, this is not overly complicated.

Native Laravel has a windows_os() helper but nothing for Darwin or Linux detection. Some actions must differentiate macOS and Linux such as the aforementioned browser launching tool.

Possible packages include:

Know of others? Have general thoughts on the matter?

Task Scheduling not working for built application

Laravel-zero: 4.0.12

When running myapp schedule:run it works as expected but when the project is built into an app, it fails.

The scheduled task is using the full phar url which doesn't work.

'/usr/bin/php7.1' 'phar:///path/to/builds/myapp/myapp' test:scheduler > '/dev/null' 2>&1

When I run the above command manually I get the following output;

Could not open input file: phar:///path/to/builds/myapp/myapp

I think there needs to be some kind of detection for when some commands are run from inside a phar and then use the appropriate path. Something like this:

if (!empty($pharPath = Phar::running(false))) {
    return dirname($pharPath);
} else {
    return app()->basePath();
}

Or I've totally missed something simple ๐Ÿ˜•

What db credentials are used

Assuming I have installed the database connector, what db credentials are used when DB commands are executed?

laravel-zero/installer fails to install

The following command fails:

composer global require laravel-zero/installer

Output includes:

laravel-zero/framework v3.10.0 requires nunomaduro/laravel-desktop-notifier 1.3.* -> satisfiable by nunomaduro/laravel-desktop-notifier[v1.3.0].

...

Conclusion: don't install nunomaduro/laravel-desktop-notifier v1.3.0

However, installing a new project with composer works fine, such as:

composer create-project --prefer-dist laravel-zero/laravel-zero foo

Auto Detecting commands

Hello everyone,

I would like to implement the "auto registering commands" feature that is also in laravel 5.5. (See Docs).

That means, all commands in the app/Commands directory (the file path would be configurable) would be registered automatically without the need to register them manually in the config file.

This just increases workflow and reduces time needed to register all commands.

Of course I don't want to remove the old way of registering commands (for example if you have a command in another directory).

I can make a PR for this but I just wanted to know if this is a wanted feature.

Have a nice day,
Jordan

Laravel Cache Facade

Not sure if this is possible, but is there a way to utilize the Laravel cache facade?

[5.7] Models and factories just work

First, thanks for making Laravel Zero. It's been incredibly useful so far.

I feel like it's worth pointing out that when you install Eloquent, you get all of the functionality of models and factories that come with it. Maybe this is something worth mentioning in the docs.

Based on the docs, I assumed that when you installed eloquent you would only be able to use the DB facade, but was surprised when I tried making an Eloquent model and everything just worked.

Additionally, if you install fzaninotto/faker and create a database/factories folder, it'll parse anything in there, just like a standard Laravel project. Factories can then be used in tests as expected.

Again, thanks for putting this together!

composer create fails at post-install

โ–ถ composer create-project --prefer-dist nunomaduro/laravel-zero swear-word-scraper
Installing nunomaduro/laravel-zero (v1.1.3)
  - Installing nunomaduro/laravel-zero (v1.1.3): Downloading (failed)       
The "https://api.github.com/repos/nunomaduro/laravel-zero/zipball/f115ab5e46a7971f2dbcc30847a974b7fd2a6fae" file could not be downloaded: failed to open stream: Operation timed out
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
Downloading (100%)         
Created project in swear-word-scraper
Loading composer repositories with package information

The "https://packagist.org/packages.json" file could not be downloaded: failed to open stream: Operation timed out
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
Updating dependencies (including require-dev)
Package operations: 42 installs, 0 updates, 0 removals
  - Installing psr/log (1.0.2): Loading from cache
  - Installing symfony/debug (v3.3.2): Downloading (failed)       
Downloading (100%)         
  - Installing symfony/polyfill-mbstring (v1.3.0): Loading from cache
  - Installing symfony/console (v3.3.2): Downloading (failed)       
Downloading (100%)         
  - Installing symfony/translation (v3.3.2): Downloading (failed)       
Downloading (100%)         
  - Installing nesbot/carbon (1.22.1): Loading from cache
  - Installing paragonie/random_compat (v2.0.10): Loading from cache
  - Installing illuminate/contracts (v5.4.19): Loading from cache
  - Installing doctrine/inflector (v1.1.0): Loading from cache
  - Installing illuminate/support (v5.4.19): Downloading (failed)       
Downloading (100%)         
  - Installing illuminate/console (v5.4.19): Downloading (failed)       
Downloading (100%)         
  - Installing illuminate/container (v5.4.19): Loading from cache
  - Installing illuminate/events (v5.4.19): Downloading (failed)       
Downloading (100%)         
  - Installing illuminate/config (v5.4.19): Downloading (100%)         
  - Installing sebastian/version (2.0.1): Loading from cache
  - Installing sebastian/resource-operations (1.0.0): Loading from cache
  - Installing sebastian/recursion-context (3.0.0): Downloading (100%)         
  - Installing sebastian/object-reflector (1.1.1): Downloading (100%)         
  - Installing sebastian/object-enumerator (3.0.2): Downloading (failed)       
Downloading (100%)         
  - Installing sebastian/global-state (2.0.0): Downloading (failed)       
Downloading (100%)         
  - Installing sebastian/exporter (3.1.0): Downloading (failed)       
Downloading (100%)         
  - Installing sebastian/environment (3.0.3): Downloading (failed)       
Downloading (100%)         
  - Installing sebastian/diff (1.4.3): Downloading (100%)         
  - Installing sebastian/comparator (2.0.0): Downloading (100%)         
  - Installing doctrine/instantiator (1.0.5): Loading from cache
  - Installing phpunit/php-text-template (1.2.1): Loading from cache
  - Installing phpunit/phpunit-mock-objects (4.0.1): Downloading (failed)       
Downloading (100%)         
  - Installing phpunit/php-timer (1.0.9): Loading from cache
  - Installing phpunit/php-file-iterator (1.4.2): Loading from cache
  - Installing theseer/tokenizer (1.1.0): Downloading (failed)       
Downloading (100%)         
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
  - Installing phpunit/php-token-stream (1.4.11): Loading from cache
  - Installing phpunit/php-code-coverage (5.2.1): Downloading (100%)         
  - Installing webmozart/assert (1.2.0): Loading from cache
  - Installing phpdocumentor/reflection-common (1.0): Loading from cache
  - Installing phpdocumentor/type-resolver (0.2.1): Loading from cache
  - Installing phpdocumentor/reflection-docblock (3.1.1): Loading from cache
  - Installing phpspec/prophecy (v1.7.0): Loading from cache
  - Installing phar-io/version (1.0.1): Downloading (100%)         
  - Installing phar-io/manifest (1.0.1): Downloading (failed)       
Downloading (failed)       
Downloading (failed)    Failed to download phar-io/manifest from dist: The "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0" file could not be downloaded: failed to open stream: Operation timed out
    Now trying to download from source
  - Installing phar-io/manifest (1.0.1): Cloning 2df402786a
  - Installing myclabs/deep-copy (1.6.1): Downloading (100%)         
  - Installing phpunit/phpunit (6.2.1): Downloading (failed)       
Downloading (100%)         
symfony/console suggests installing symfony/event-dispatcher ()
symfony/console suggests installing symfony/filesystem ()
symfony/console suggests installing symfony/process ()
symfony/translation suggests installing symfony/config ()
symfony/translation suggests installing symfony/yaml ()
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
illuminate/support suggests installing illuminate/filesystem (Required to use the composer class (5.2.*).)
illuminate/support suggests installing symfony/process (Required to use the composer class (~3.2).)
illuminate/support suggests installing symfony/var-dumper (Required to use the dd function (~3.2).)
illuminate/console suggests installing guzzlehttp/guzzle (Required to use the ping methods on schedules (~6.0).)
illuminate/console suggests installing mtdowling/cron-expression (Required to use scheduling component (~1.0).)
illuminate/console suggests installing symfony/process (Required to use scheduling component (~3.2).)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.3)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
Writing lock file
Generating autoload files
> php application install
PHP Fatal error:  Uncaught TypeError: Return value of App\Console\Commands\Build::configure() must be an instance of App\Console\Commands\void, none returned in /private/var/www/swear-word-scraper/app/Console/Commands/Build.php:57
Stack trace:
#0 /private/var/www/swear-word-scraper/vendor/symfony/console/Command/Command.php(63): App\Console\Commands\Build->configure()
#1 /private/var/www/swear-word-scraper/vendor/illuminate/console/Command.php(124): Symfony\Component\Console\Command\Command->__construct('build')
#2 /private/var/www/swear-word-scraper/vendor/illuminate/console/Command.php(98): Illuminate\Console\Command->configureUsingFluentDefinition()
#3 /private/var/www/swear-word-scraper/app/Console/Application.php(86): Illuminate\Console\Command->__construct()
#4 /private/var/www/swear-word-scraper/app/Console/Application.php(69): App\Console\Application->registerBaseCommands()
#5 /private/var/www/swear-word-scraper/bootstrap/app.php(20): App\Console\Application->__construct(Object(Illuminate\Container\Container), Object(I in /private/var/www/swear-word-scraper/app/Console/Commands/Build.php on line 57

Fatal error: Uncaught TypeError: Return value of App\Console\Commands\Build::configure() must be an instance of App\Console\Commands\void, none returned in /private/var/www/swear-word-scraper/app/Console/Commands/Build.php:57
Stack trace:
#0 /private/var/www/swear-word-scraper/vendor/symfony/console/Command/Command.php(63): App\Console\Commands\Build->configure()
#1 /private/var/www/swear-word-scraper/vendor/illuminate/console/Command.php(124): Symfony\Component\Console\Command\Command->__construct('build')
#2 /private/var/www/swear-word-scraper/vendor/illuminate/console/Command.php(98): Illuminate\Console\Command->configureUsingFluentDefinition()
#3 /private/var/www/swear-word-scraper/app/Console/Application.php(86): Illuminate\Console\Command->__construct()
#4 /private/var/www/swear-word-scraper/app/Console/Application.php(69): App\Console\Application->registerBaseCommands()
#5 /private/var/www/swear-word-scraper/bootstrap/app.php(20): App\Console\Application->__construct(Object(Illuminate\Container\Container), Object(I in /private/var/www/swear-word-scraper/app/Console/Commands/Build.php on line 57
Script php application install handling the post-create-project-cmd event returned with error code 255

[3.5 - Proposal] Scheduled Tasks

Hello,

A very missing thing in this awesome framework is Scheduler. The only thing which stops me from using Laravel Zero for my console applications is that it misses scheduler.

Any plans for this feature?

[Bug] Compiled binary does not migrate

When running the migration command from the compile command only the migration table is created:

$ <my-command> migrate --force
Migration table created successfully.
Nothing to migrate.

However if I run the command from source my migration does happen.

$ ./<my-command> migrate --force
Migration table created successfully.
Migrating: 2017_11_14_001328_CreateOrmProfilesTable
Migrated:  2017_11_14_001328_CreateOrmProfilesTable

Cache example

I'm with problems to use cache component. I already installed the component but can't configure and use properly. Can you give some example :)

Thanks for this great tool :)

How can i use Laravel Log Facade.

when i used laravel log facade, i got the BindingResolutionException.

\Illuminate\Support\Facades\Log::debug('debug msg');
 Illuminate\Contracts\Container\BindingResolutionException : Target [Psr\Log\LoggerInterface] is not instantiable.

how can i instantiation Log facade.?

[Proposal] git tag as app version

It would be great if we could have the git tag or the commit hash or both as the application version. This would alleviate the need to update config/app.php when we have a new version.

[4.0] Disable scheduler

Hi, Is it possible to disable the schedule commands as my application has no use for them?

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.