Generated by GPT-5-mini| Artisan (command-line interface) | |
|---|---|
| Name | Artisan (command-line interface) |
| Developer | Taylor Otwell |
| Released | 2013 |
| Programming language | PHP |
| Operating system | Cross-platform |
| License | MIT License |
Artisan (command-line interface) is a command-line interface bundled with the Laravel (web framework) project, providing a suite of developer utilities for application scaffolding, database migrations, task scheduling, and interactive REPL-like commands. It integrates tightly with the Symfony (software) Console component, leverages conventions from Composer (software) package management, and is frequently used alongside tools such as Homestead (software), Valet (software), and Forge (software). Artisan accelerates common workflows for projects maintained by teams using practices popularized by contributors to Laravel Horizon, Laravel Nova, Laravel Dusk, Taylor Otwell, and ecosystem packages on Packagist.
Artisan exposes commands through a CLI binary typically invoked as "php artisan", enabling operations for routing, caching, queue management, and code generation. The tool relies on the Illuminate (PHP) components that underpin Laravel (web framework) and interoperates with libraries from Symfony (software) for console input/output, Psr (PHP Standards Group) interfaces for logging, and Monolog (software) for structured logs. Commonly used commands scaffold controllers, jobs, events, and resources, facilitating rapid development in projects that follow patterns exemplified by apps like Laravel Spark and OctoberCMS.
Artisan was introduced by Taylor Otwell as part of the early Laravel releases, with design influences drawn from CLI tools in frameworks such as Ruby on Rails' rake tasks, Symfony (software) Console, and utilities found in CodeIgniter. Over multiple major Laravel versions, contributors from the Laravel community and organizations like GitHub broadened Artisan's capabilities, adding features for queue workers, scheduler integration inspired by Cron, and interactive tinker shells influenced by PsySH. Releases through Packagist and pull requests hosted on GitHub reflect iterative enhancements aligned with PHP language updates and interoperability standards set by PHP-FIG.
Artisan is installed automatically as part of a Laravel (web framework) application created via Composer (software) create-project commands or via starter kits such as Laravel Breeze and Laravel Jetstream. To run Artisan developers need a local PHP runtime compatible with versions referenced in composer.json and extensions commonly available in distributions maintained by Ubuntu, Debian, CentOS, or macOS managed with Homebrew. Deployment environments provisioned through services like Forge (software), Envoyer (software), or containerized images on Docker (software) include Composer and PHP binaries enabling "php artisan" to be executed in shells managed by Bash (Unix shell), Zsh, or CI pipelines hosted on GitLab CI, Jenkins, GitHub Actions, and CircleCI.
Artisan ships with built-in commands such as make:controller, make:model, migrate, db:seed, route:list, cache:clear, config:cache, queue:work, schedule:run, and tinker. Developers often combine these using shell features or orchestration tools like Ansible (software), Chef (software) or Puppet (software) in production. The command registration system accepts custom commands implemented as classes that extend the base command type provided by Symfony (software) Console, and third-party packages published via Packagist or GitHub add commands for integrations with services like Pusher, Sentry (software), Algolia, Stripe, Inc., and AWS components from Amazon Web Services. Typical usage patterns mirror conventions used in projects showcased at conferences like Laracon.
Artisan reflects application configuration defined in files located under the config directory such as app.php, database.php, cache.php, and queue.php, and reads environment variables from .env files following conventions associated with the dotenv specification championed by projects like 12factor.net. Environment-specific behaviors are commonly managed with deployment tools from Envoyer (software) or container orchestration platforms like Kubernetes and Docker Compose. The CLI respects PHP ini settings, runtime extensions, and service credentials stored in platforms like Vault (software), AWS Secrets Manager, or Azure Key Vault when configured by teams at organizations such as DigitalOcean or Linode.
Artisan commands are designed to be automated in shell scripts, scheduled tasks configured through Laravel's scheduler that maps to system Cron entries, and CI/CD workflows orchestrated via GitHub Actions, GitLab CI, Jenkins, or Travis CI. Developers implement command chaining, graceful shutdown handling, and logging integrations compatible with Monolog (software) and centralized log providers such as Papertrail or Datadog. Complex automation often combines Artisan with database migration tools used in projects influenced by Flyway or Liquibase, and with testing frameworks like PHPUnit and browser automation suites such as Laravel Dusk.
Artisan runs with the permissions of the invoking user and thus must be executed in contexts that protect credentials and environment variables. Best practices align with guidance from OWASP and platform-specific recommendations from providers like Amazon Web Services and Microsoft Azure regarding secrets management and role-based access controls, while CI systems enforce least privilege using fine-grained tokens from GitHub or service principals in Azure Active Directory. When running console commands that affect databases, queues, or caches, teams coordinate with operations tooling from Ansible (software), Terraform and auditing solutions like Splunk to ensure compliance and traceability.
Category:Command-line interfaces