All Projects → caneco → artisan-aliases

caneco / artisan-aliases

Licence: MIT license
Save keystrokes and run Artisan commands your way

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to artisan-aliases

laravel-admin
LaravelAdmin是基于PHP开发的基础管理后台系统,做到开箱即用,为新项目开发省去了基础功能开发的步骤;此系统采用前后端分离模式,后端使用Laravel,前端使用vue;主要包含:登录、注销、可视化数据大屏、管理员、角色管理、菜单管理、权限管理、错误日志、登录日志、访问日志、获取服务器CPU使用率、内存使用率等功能。后端主要使用Artisan命令行、Jobs消息队列、 Rules验证规则、Restful API、Composer扩展包、Redis秒杀、Extend自定义扩展类:微信授权、钉钉告警推送、MongoDB、阿里云OSS、七牛云存储、七牛云直播、php-jwt TOKEN、Phpoffice、MySql数据库字典、Elasticsearch等技术。
Stars: ✭ 45 (+95.65%)
Mutual labels:  command, artisan
aly
Command Line Alias Manager and Plugin System - Written in Golang
Stars: ✭ 21 (-8.7%)
Mutual labels:  aliases
RS232-Monitor-Database
🔌📺 This is a public database for all the known RS232 commands for professionnal screens, monitors and projectors. Feel free to contribute !
Stars: ✭ 22 (-4.35%)
Mutual labels:  command
vscode-powertools
A swiss army knife with lots of tools, extensions and (scriptable) enhancements for Visual Studio Code.
Stars: ✭ 44 (+91.3%)
Mutual labels:  command
laravel-tinker
Adds a way to write php and run it directly in Laravels' Artisan Tinker.
Stars: ✭ 123 (+434.78%)
Mutual labels:  artisan
tpack
Pack a Go workflow/function as a Unix-style pipeline command
Stars: ✭ 55 (+139.13%)
Mutual labels:  command
laravel-migrate-check
An artisan command to check for pending migrations with proper exit code
Stars: ✭ 53 (+130.43%)
Mutual labels:  artisan
gw
A Wrapper of a command to watch any changes in filesystem
Stars: ✭ 16 (-30.43%)
Mutual labels:  command
fzf-marker
The terminal command tweak from @pindexis/marker
Stars: ✭ 22 (-4.35%)
Mutual labels:  command
project template
Enjoy🌈 web项目启动模板 & 命令行cli启动模板 & 库启动模板
Stars: ✭ 19 (-17.39%)
Mutual labels:  command
Asciidots-Cheat-Sheet
My personal Asciidots Cheat Sheet in .jpg .odt .pdf .png and obviously in .txt
Stars: ✭ 17 (-26.09%)
Mutual labels:  command
wtfcmd
Run commands by fully custom aliases
Stars: ✭ 16 (-30.43%)
Mutual labels:  command
lookpath
The minimum and most straightforward way to check if command exists and where the executable is, without spawning child_process.
Stars: ✭ 49 (+113.04%)
Mutual labels:  command
goto
A fish shell utility to quickly navigate to aliased directories supporting tab-completion
Stars: ✭ 17 (-26.09%)
Mutual labels:  aliases
command-flow
A flexible command framework and dispatcher which removes lots of boilerplate code used in commands. While it is used generally on Bukkit it is platform agnostic
Stars: ✭ 103 (+347.83%)
Mutual labels:  command
node-evented-command
provides simple command/event handling for evented systems like cqrs
Stars: ✭ 15 (-34.78%)
Mutual labels:  command
Server
The whir.io chat server.
Stars: ✭ 15 (-34.78%)
Mutual labels:  command
dynamic-cli
A Modern, user-friendly command-line HTTP client for the API testing, and if you're stuck - Search and browse StackOverflow without leaving the CLI
Stars: ✭ 151 (+556.52%)
Mutual labels:  command
php-exec-command
Simple php command executor with param binding
Stars: ✭ 20 (-13.04%)
Mutual labels:  command
runn
Make your own terminal aliases easily!
Stars: ✭ 18 (-21.74%)
Mutual labels:  aliases


Total Downloads Latest Stable Version License


Laravel Artisan Aliases

If you live in the command it's always good to save some keystrokes, specially for commands that you keep typing. This package will help you create alias for you artisan commands, and more..

Installation

You can install the package via composer:

>_ composer require caneco/artisan-aliases

Registering the service provider

In Laravel 5.5 the service provider will automatically get registered. But if needed just add the service provider in config/app.php file:

'providers' => [
    // ...
    Caneco\ArtisanAliases\ArtisanAliasesServiceProvider::class,
];

Publishing the package assets

To publish the configuration file and .laravel_alias, execute the following command and pick this Service Provider:

>_ php artisan vendor:publish

 Which provider or tag's files would you like to publish?:
  [0 ] Publish files from all providers and tags listed below
  [1 ] Provider: Caneco\ArtisanAliasesExample:
  [… ] ...

Or do it in a single command:

>_ php artisan vendor:publish --provider="Caneco\ArtisanAliases\ArtisanAliasesServiceProvider"

When published, this is the contents of the config file:

return [

    /*
    |--------------------------------------------------------------------------
    | Artisan Alias Master Switch
    |--------------------------------------------------------------------------
    | This option may be used to enable/disable all Artisan alias
    | defined in your local or global `.laravel_alias` file
    */
    'enabled' => env('ARTISAN_ALIAS_ENABLED', true),

    /*
    |--------------------------------------------------------------------------
    | Default Alias File
    |--------------------------------------------------------------------------
    | This option allows you to have three ways of load the list of alias. The
    | `global` option will only load the alias defined in your home directory,
    | while the `local` option, will limit the alias from the list in your
    | application. Finally, The `both` option, or anything else, will
    | load the alias from both locations.
    |
    | Supported: "global", "local", "both",
    */
    'use_only' => 'both',

];

Usage

After publishing the initial files, your alias will be stored folder locally in the application directory; or globally in your home directory. And like any other bash alias file the contents will have following format:

laravel="inspire"
# cc="clear-compiled"

Listing existing alias

To list the current alias available you can run the following command:

>_ php artisan alias --list
Laravel `Artisan Aliases` 1.1.0

Usage:
 alias [-g|--global] [--] [<as>]

Available alias:
 laravel inspire
 cc      clear-compiled

Also, the available alias in appear on your artisan command list:

$ php artisan list
...
Available commands:
  alias                Create an alias of another command
  cc                   * Alias for the `clear-compiled` command
  clear-compiled       Remove the compiled class file
  down                 Put the application into maintenance mode
  ...
  inspire              Display an inspiring quote
  laravel              * Alias for the `inspire` command
  list                 Lists commands
  ...

Adding new alias

Add your alias directly in the file .laravel_alias, or just use the artisan command:

>_ php artisan alias laravel "inspire"

And, if you pass the --global option the alias will be registered instead in the .laravel_alias of your home directory.

>_ php artisan alias cc="clear-compiled" --global

If you dont pass the required arguments the --list option will be triggered, and you will be presented with the command info; usage; and list of alias available.

Comments

Anything after the character # it's considered a comment and will be not considered for execution.

# https://twitter.com/davidhemphill/status/1083466919964041217
migrate:make="make:migration" # DOPE

Quote surrounding

Surrounding the command with quotes are not mandatory, but if the command to be aliased has some spaces you must use them.

Multiple commands

An alias can have multiple commands associated by using the operators && or ||. And, just like bash, when using && the sequence of the commands will terminate if one of them returns a value bigger than zero. While the || will continue no matter what.

# EXAMPLE

tables-up=notifications:table && queue:table && queue:failed-table && ...

Shell commands

If you prefix your alias with an exclamation point, will be treated as a shell command.

Aliasception…

Yes, you can also create alias of alias...

Artisan groups

If you set your alias with a namespace like boot:tables or boot:cache, Artisan list will group your alias toghether.

# EXAMPLE

boot
 boot:cache    * Alias for the `config:cache || route:cache || view:cache command`
 boot:tables   * Alias for the `cache:table || notifications:table || queue:failed-table || queue:table || session:table command`

Gotchas ⚠️

  • Currently, to modify or delete any alias you need to open the .laravel_aliases and do it manually but it's planned to have a way of doing from the terminal.
  • Adding an alias with the same name as other it will result with an exception.
  • Having two alias manually defined in the .laravel_aliases the last alias command will prevail.
  • An alias with the same name as an Artisan command, the Artisan prevail.

Supported versions

Look at the table below to find out what versions of Laravel are supported on what version of this package:

Laravel Framework Artisan Alias
5.7.* ^1.0

Road map

Artisan Alias is stable but there is still some things that I would like to add in the package.

Here's the plan for what's coming:

  • Remove an existing alias using the option --d|delete
  • Firing a @handle method if alias has a ::class reference
  • Alert the user try to add an alias with sudo in the command (usefull?)
  • Add comments
  • Allow to replace an existing alias using the option --force
  • Add tests

Contributing

All contributions (pull requests, issues and feature requests) are welcome. Make sure to read through the Contributing file first, though. See the contributors page for all contributors.

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].