A package that makes it easy to have the `artisan make:` commands open the newly created file in your editor of choice.

Related tags

Laravel open-on-make
Overview

Open On Make

A package that makes it easy to have the artisan make: commands open the newly created file in your editor of choice.

Installation

composer require --dev ahuggins/open-on-make

This package defaults to VS Code using the code command, this can be changed by using the Artisan command:

php artisan open:install

It will ask you which editor you want, enter the corresponding number and hit enter. It will update your env file with the CLI command.

You can still set this manually, this was intended to streamline the process, make it a little faster and one less thing to look up.

Feel free to suggest or open a PR with additional editors if anything is missing.

Set env Editor manually

OPEN_ON_MAKE_EDITOR=nameOfCliCommandForEditor
OPEN_ON_MAKE_FLAGS='-a' // Flags you need passed to the above Command

Most people will probably only need to add OPEN_ON_MAKE_EDITOR to their .env file.

Publish the config

  • publish the package config with

    php artisan vendor:publish --tag=open-on-make

Disable the package

Some team members may want to disable this feature.

You can explicitly disable this package by setting the OPEN_ON_MAKE_ENABLED environment variable:

OPEN_ON_MAKE_ENABLED=false

Example Editor values

Sublime - OPEN_ON_MAKE_EDITOR=subl

PHPStorm - OPEN_ON_MAKE_EDITOR=pstorm Setup Instructions: https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html

Atom - OPEN_ON_MAKE_EDITOR=atom Provided you have shell commands installed: https://user-images.githubusercontent.com/1791228/38758555-814eb602-3f3f-11e8-8071-3c9690bb0374.png

VS Code = OPEN_ON_MAKE_EDITOR=code Provided you have the code shell command installed: https://code.visualstudio.com/docs/setup/mac

License

Licensed under the MIT license

Comments
  • How to works with PhpStorm installed from Brew

    How to works with PhpStorm installed from Brew

    Hi.

    Installing PhpStorm from Brew doesn't seems to create a symlink. Is there a way to workaround this? Tried a couple of solutions what haven't worked at all.

    Thanks for any help.

    opened by jsilva74 5
  • Custom make commands

    Custom make commands

    Hi, nice extension. How should i add custom make commands to the path variable? Currently I get sth. like this for my make:trait command - "Undefined index: trait" Thanks

    opened by eporsche 5
  • Autoload Deprecation with Composer V2

    Autoload Deprecation with Composer V2

    Deprecation Notice: Class OpenOnMake\OpenFile located in ./vendor/ahuggins/open-on-make/src/OpenFIle.php does not comply with psr-4 autoloading standard. It will not autoload anymore in Composer v2.0. in phar:///usr/local/bin/composer/src/Composer/Autoload/ClassMapGenerator.php:201

    opened by ronnorthrip 4
  • Call to a member function getOption() on null

    Call to a member function getOption() on null

    Sorry for keeping it brief, would have looked further into it if I had the time. Please ask if you need more info.

    This package is causing an error in my project, could reproduce it in a new project:

    laravel new bug-test
    cd bug-test
    php artisan make:test FooBarTest    # all good - without this package
    composer require --dev ahuggins/open-on-make
    php artisan make:test FooBarzTest    # error - with this package
    

    Verbose error:

       Symfony\Component\Debug\Exception\FatalThrowableError  : Call to a member function getOption() on null
    
      at /Users/guido/Developer/personal-projects/bug-test/vendor/laravel/framework/src/Illuminate/Console/Command.php:363
        359|         if (is_null($key)) {
        360|             return $this->input->getOptions();
        361|         }
        362| 
      > 363|         return $this->input->getOption($key);
        364|     }
        365| 
        366|     /**
        367|      * Get all of the options passed to the command.
    
      Exception trace:
    
      1   Illuminate\Console\Command::option("unit")
          /Users/guido/Developer/personal-projects/bug-test/vendor/laravel/framework/src/Illuminate/Foundation/Console/TestMakeCommand.php:66
    
      2   Illuminate\Foundation\Console\TestMakeCommand::getDefaultNamespace("Tests")
          /Users/guido/Developer/personal-projects/bug-test/vendor/laravel/framework/src/Illuminate/Console/GeneratorCommand.php:97
    
      3   Illuminate\Console\GeneratorCommand::qualifyClass("FooBarzTest")
          [internal]:0
    
      4   ReflectionMethod::invokeArgs(Object(Illuminate\Foundation\Console\TestMakeCommand))
          /Users/guido/Developer/personal-projects/bug-test/vendor/ahuggins/open-on-make/src/Listeners/OpenOnMake.php:150
    
      5   OpenOnMake\Listeners\OpenOnMake::determineFilePath()
          /Users/guido/Developer/personal-projects/bug-test/vendor/ahuggins/open-on-make/src/Listeners/OpenOnMake.php:65
    
      6   OpenOnMake\Listeners\OpenOnMake::handle(Object(Illuminate\Console\Events\CommandFinished))
          /Users/guido/Developer/personal-projects/bug-test/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:366
    
      7   call_user_func_array()
          /Users/guido/Developer/personal-projects/bug-test/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:366
    
      8   Illuminate\Events\Dispatcher::Illuminate\Events\{closure}("Illuminate\Console\Events\CommandFinished")
          /Users/guido/Developer/personal-projects/bug-test/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php:196
    
      9   Illuminate\Events\Dispatcher::dispatch("Illuminate\Console\Events\CommandFinished")
          /Users/guido/Developer/personal-projects/bug-test/vendor/laravel/framework/src/Illuminate/Console/Application.php:93
    
      10  Illuminate\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
          /Users/guido/Developer/personal-projects/bug-test/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:131
    
      11  Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
          /Users/guido/Developer/personal-projects/bug-test/artisan:37
    
    opened by GuidoHendriks 4
  • Using VSCode with Remote opens in new window

    Using VSCode with Remote opens in new window

    Love this wee package, used if your years.

    Seems to now open newly made files in a new window though. I'm using remote - ssh for my development environment. Not sure if that's the issue?

    opened by sunscreem 3
  • Seems to fall over on make:observer

    Seems to fall over on make:observer

    After the artisan command make:observer runs it seems the package falls over:

       ErrorException  : Undefined index: observer
    
      at C:\www\ryder\vendor\ahuggins\open-on-make\src\Listeners\OpenOnMake.php:45
        41|                 $path = base_path($this->getTestPath($event) . $this->filename($event));
        42|             } elseif ($classType === 'migration') {
        43|                 $path = $this->getLatestMigrationFile();
        44|             } else {
      > 45|                 $path = base_path($this->paths[$classType] . $this->filename($event));
        46|             }
        47|
        48|             exec(
        49|                 config('open-on-make.editor') . ' ' .
    
      Exception trace:
    
      1   Illuminate\Foundation\Bootstrap\HandleExceptions::handleError("Undefined index: observer", "C:\www\ryder\vendor\ahuggins\open-on-make\src\Listeners\OpenOnMake.php", [Object(Illuminate\Console\Events\CommandFinished), "observer"])
          C:\www\ryder\vendor\ahuggins\open-on-make\src\Listeners\OpenOnMake.php:45
    
      2   OpenOnMake\Listeners\OpenOnMake::handle(Object(Illuminate\Console\Events\CommandFinished))
          C:\www\ryder\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php:379
    

    Clean 5.6 project.

    opened by sunscreem 3
  •  Ability to Explicitly Disable the Listener

    Ability to Explicitly Disable the Listener

    Depending on team workflow, not everyone might want this package enabled. This update provides a new configuration to conditionally disable the event listener via environment:

    OPEN_ON_MAKE_ENABLED=false
    
    opened by paulredmond 3
  • Making a test with a more complicated path doesn't open the file

    Making a test with a more complicated path doesn't open the file

    Was running through a test tutorial and this failed to open the file: php artisan make:test Http/Controllers/Auth/LoginControllerTest

    This works: php artisan make:test LoginControllerTest

    And this works: php artisan make:test Http/Controllers/Auth/LoginControllerTest.php

    opened by ronnorthrip 2
  • MigrateMakeCommand::getPath() does not exist

    MigrateMakeCommand::getPath() does not exist

    I've been getting this error since last update (not sure what version I was on previously) it only happens on some make commands, not all. make:migration is one that it does happen on.

    Method Illuminate\Database\Console\Migrations\MigrateMakeCommand::getPath() does not exist
    

    it happens in /vendor/ahuggins/open-on-make/src/Listeners/OpenOnMake.php:139

        137|     public function determineFilePath()
        138|     {
      > 139|         $pathMethod = new \ReflectionMethod($this->getCommandClass(), 'getPath');
        140|         $pathMethod->setAccessible(true);
        141| 
        142|         $qualifyMethod = new \ReflectionMethod($this->getCommandClass(), 'qualifyClass');
        143|         $qualifyMethod->setAccessible(true);
    

    I've not had a chance to dig into it.

    opened by tobz-nz 2
  • Throw error on all make commands

    Throw error on all make commands

    I'm getting this error for all artisan make commands:

    [2018-09-06 03:13:17] local.ERROR: Symfony\Component\Console\Exception\InvalidArgumentException: The "name" argument does not exist. in /Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/symfony/console/Input/Input.php:110
    Stack trace:
    #0 /Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/ahuggins/open-on-make/src/Listeners/OpenOnMake.php(68): Symfony\Component\Console\Input\Input->getArgument('name')
    #1 /Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/ahuggins/open-on-make/src/Listeners/OpenOnMake.php(45): OpenOnMake\Listeners\OpenOnMake->filename(Object(Illuminate\Console\Events\CommandFinished))
    #2 [internal function]: OpenOnMake\Listeners\OpenOnMake->handle(Object(Illuminate\Console\Events\CommandFinished))
    #3 /Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(379): call_user_func_array(Array, Array)
    #4 /Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(209): Illuminate\Events\Dispatcher->Illuminate\Events\{closure}('Illuminate\\Cons...', Array)
    #5 /Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(182): Illuminate\Events\Dispatcher->dispatch('Illuminate\\Cons...', Array, false)
    #6 /Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/laravel/framework/src/Illuminate/Console/Application.php(92): Illuminate\Events\Dispatcher->fire(Object(Illuminate\Console\Events\CommandFinished))
    #7 /Users/tobyevans/Code/dovetailx/api.dovetailx/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #8 /Users/tobyevans/Code/dovetailx/api.dovetailx/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #9 {main}  
    

    Laravel 5.6

    opened by tobz-nz 2
  • Fix bug when project's folder has space characters

    Fix bug when project's folder has space characters

    My project is located in a folder with space in the name and this package doesn't work well with this. It opens 2 new empty tabs in visual studio code. To fix this i added double quotes to the file path and it works as expected.

    opened by AndreiTelteu 2
  • Bump league/flysystem from 1.1.3 to 1.1.4

    Bump league/flysystem from 1.1.3 to 1.1.4

    Bumps league/flysystem from 1.1.3 to 1.1.4.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump laravel/framework from 7.26.1 to 7.30.4

    Bump laravel/framework from 7.26.1 to 7.30.4

    Bumps laravel/framework from 7.26.1 to 7.30.4.

    Release notes

    Sourced from laravel/framework's releases.

    v7.30.4

    Fixed

    • Fixed empty html mail (#35941)
    • Fixed type error in Illuminate\Http\Concerns\InteractsWithContentTypes::isJson() (#35956)
    • Limit expected bindings (#35972, 006873d)

    v7.30.3

    v7.30.3 (2021-01-15)

    v7.30.2

    v7.30.2 (2021-01-13)

    Added

    • Added strings to DetectsLostConnections (#35752)

    Fixed

    • Fixed error from missing null check on PHP 8 (#35797)
    • Limit expected bindings (#35865)

    Changed

    • Retry connection if DNS lookup fails (#35790)

    v7.30.1

    v7.30.1 (2020-12-22)

    Fixed

    • Backport for fix issue with polymorphic morphMaps with literal 0 (#35487)
    • Fixed mime validation for jpeg files (#35518)
    • Fixed Illuminate\Validation\Concerns\ValidatesAttributes::validateJson() for PHP8 (#35646)
    • Catch DecryptException with invalid X-XSRF-TOKEN in Illuminate\Foundation\Http\Middleware\VerifyCsrfToken (#35671)

    v7.30.0

    v7.30.0 (2020-12-01)

    Fixed

    • Turn the eloquent collection into a base collection if mapWithKeys loses models (#35129)
    • Fixed pivot restoration (#35218)
    • Fixing BroadcastException message in PusherBroadcaster@broadcast (#35290)
    • Fixed generic DetectsLostConnection string (#35323)
    • Backport Redis context option (#35370)
    • Fixed validating image/jpeg images after Symfony/Mime update (#35419)

    Changed

    • Updated aws/aws-sdk-php suggest to ^3.155 (#35267)

    v7.29.3

    v7.29.3 (2020-11-03)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(1.0.4)
Owner
Andrew Huggins
Andrew Huggins
Package for Laravel that gives artisan commands to setup and edit environment files.

Setup and work with .env files in Laravel from the command line NOTE: This doesn't work with Laravel 5 since .env files were changed. This is for Lara

Matt Brunt 6 Dec 17, 2022
📝 Artisan Menu - Use Artisan via an elegant console GUI

?? Artisan Menu Use Artisan via an elegant console GUI Features Run built-in and custom Artisan commands from a console GUI Prompts to enter required

Jordan Hall 149 Dec 29, 2022
📝 Artisan Menu - Use Artisan via an elegant console GUI

?? Artisan Menu Use Artisan via an elegant console GUI Features Run built-in and custom Artisan commands from a console GUI Prompts to enter required

Jordan Hall 148 Nov 29, 2022
A bookmarkable, searchable cheatsheet for all of Laravel's default Artisan commands.

artisan.page A bookmarkable, searchable cheatsheet for all of Laravel's default Artisan commands. Generation The generation of the manifest files is d

James Brooks 284 Dec 25, 2022
Laravel API architecture builder based on artisan commands.

??‍?? API-Formula Laravel API architecture builder based on artisan commands. This package provides a nice and fluent way to generate combined control

Krševan Lisica 1 Jan 16, 2022
This Laravel Nova tool lets you run artisan and bash commands directly from Nova 4 or higher.

Laravel Nova tool for running Artisan & Shell commands. This Nova tool lets you run artisan and bash commands directly from nova. This is an extended

Artem Stepanenko 17 Dec 15, 2022
Execute Laravel Artisan commands via REST APIs and HTTP requests safely.

Artisan Api There might be some times you wanted to execute an Artisan command, but you did not have access to shell or SSH. Here we brought REST API

Alireza 11 Sep 7, 2022
This package provides you with a simplistic `php artisan make:user` command

Laracademy Generators Laracademy make:user Command - provides you with a simplistic artisan command to generate users from the console. Author(s): Lar

Laracademy 18 Jan 19, 2019
File & Folders & Media Browser With Code Editor

Filament Browser File & Folders & Media Browser With Code Editor Features File Browser Code Editor with highlights Media Viewer .Env Editor Screenshot

Fady Mondy 23 Jan 5, 2023
Renamify is a package for Laravel used to rename a file before uploaded to prevent replacing exists file which has the same name to this new uploaded file.

Renamify Laravel package for renaming file before uploaded on server. Renamify is a package for Laravel used to rename a file before uploaded to preve

MB'DUSENGE Callixte 2 Oct 11, 2022
You already have your dream house? Sam Building will help you find the perfect home.

SAM BUILDING Setup Fork or clone this repo! git clone github.com/Igorballo/Real-Estate-App.git Installation des dépendances npm install #or yarn insta

null 4 Nov 29, 2022
This Laravel 8 package makes it possible for you to set your website in "Under Construction" mode.

Laravel Under Construction This Laravel package makes it possible to set your website in "Under Construction" mode. Only users with the correct 4 digi

Lars Janssen 571 Dec 18, 2022
Integrates the Trix Editor with Laravel. Inspired by the Action Text gem from Rails.

Integrates the Trix Editor with Laravel. Inspired by the Action Text gem from Rails. Installation You can install the package via composer: composer r

Tony Messias 267 Jan 4, 2023
this package makes laravel website a progressive web application.

Laravel PWA You can follow this video tutorial as well for installation. Installation Install the package by the following command, composer require l

Shailesh Ladumor 86 Dec 16, 2022
Laravel package for giving admin-created accounts to users via 'set-password' email.

Invytr When making a website where users are created instead of registering themselves, you are faced with the challenge of safely giving users the ac

GlaivePro 64 Jul 17, 2022
This package was created to deal with laravel datatables and cruds using vuejs.

datatable-cruds Installation This package was created to deal with laravel datatables and cruds using vuejs. Install the package through Composer. Run

Osama Saad 9 Dec 19, 2022
A Pocketmine 4.0 Plugin which makes your server query = Current players + 1 Total Slots

The Better-Query Plugin This Plugin implements Better Query System **(i.e. 0/1 as player count)** the server total slots increases by 1 after a player

RealBJsingh 3 May 14, 2022
This package is to add a web interface for Laravel 5 and earlier Artisan.

Nice Artisan This package is to add a web interface for Laravel 5 and earlier Artisan. Installation Add Nice Artisan to your composer.json file : For

null 218 Nov 29, 2022
Postgis extensions for laravel. Aims to make it easy to work with geometries from laravel models.

Laravel Wrapper for PostgreSQL's Geo-Extension Postgis Features Work with geometry classes instead of arrays. $model->myPoint = new Point(1,2); //lat

Max 340 Jan 6, 2023