개발자의 끄적끄적

[lalavel] 라라벨 artisan 명령어 정리! 본문

개발/php

[lalavel] 라라벨 artisan 명령어 정리!

효벨 2025. 5. 11. 09:00
728x90
반응형

[lalavel] 라라벨 artisan 명령어 정리!

 

made by Gemini

 

안녕하세요!

 

오랜만에 다시 본업으로 돌아와서

 

php 프레임워크로 많이 쓰이는

 

Lalavel 프레임워크에 대해서 공유해보려고 합니다!

 

그중에서

 

기본적으로 라라벨에서 제공하는 CLI 인 artisan 명령어에 대해서 정리해 보았습니다!

 

아래 명령어들을 이용하면

 

프로젝트를 더 빠르고 효율적으로 관리할 수 있습니다!

 

 


 

🧰 Artisan 명령어 전체 정리 (자주 쓰는 명령어 중심)

 

명령어 설명 예시
php artisan list 사용 가능한 모든 artisan 명령어 목록 출력 -
php artisan help 명령어 해당 artisan 명령어에 대한 도움말 제공 php artisan help make:model

 

 


 

🔧 기본 설정 관련

 

명령어 설명
php artisan serve 로컬 개발 서버 실행 (기본 포트 8000)
php artisan config:cache 설정파일을 캐시 (성능 향상)
php artisan config:clear 설정 캐시 삭제
php artisan route:cache 라우트 캐시 생성
php artisan route:clear 라우트 캐시 삭제
php artisan view:clear 컴파일된 뷰 캐시 삭제
php artisan cache:clear
애플리케이션 캐시 삭제

 

 

 


 

🧱 코드 생성 관련 (make)

 

명령어 설명 예시
php artisan make:controller 컨트롤러 생성 php artisan make:controller PostController
php artisan make:model 모델 생성 php artisan make:model Post
php artisan make:migration 마이그레이션 생성 php artisan make:migration create_posts_table
php artisan make:seeder 시더 생성 php artisan make:seeder UsersTableSeeder
php artisan make:factory 팩토리 생성 php artisan make:factory PostFactory
php artisan make:middleware 미들웨어 생성 php artisan make:middleware CheckRole
php artisan make:request 폼 요청 클래스 생성 php artisan make:request StorePostRequest
php artisan make:command 커스텀 artisan 명령어 생성 php artisan make:command SendEmails
php artisan make:job 큐 작업 생성 php artisan make:job ProcessPodcast
php artisan make:event 이벤트 클래스 생성 php artisan make:event OrderShipped

 

 


 

💾 데이터베이스 관련

 

명령어 설명
php artisan migrate 모든 마이그레이션 실행
php artisan migrate:rollback 최근 마이그레이션 되돌리기
php artisan migrate:reset 모든 마이그레이션 되돌리기
php artisan migrate:refresh 마이그레이션 초기화 후 재실행
php artisan db:seed 시더 실행 (DatabaseSeeder 기본)
php artisan migrate:fresh 모든 테이블 삭제 후 마이그레이션 재실행
php artisan migrate:status 마이그레이션 상태 확인

 

 


 

🧪 테스트 & 디버깅

 

명령어 설명
php artisan tinker Laravel Shell (실행 환경에서 객체 및 DB 테스트)
php artisan test PHP Unit 테스트 실행
php artisan dump-server 디버그 정보 보기 (Laravel < 8)

 

 

 


 

🕓 스케줄 및 큐 관련

 

명령어 설명
php artisan queue:work 큐 처리 실행
php artisan queue:listen 큐 리스너 실행
php artisan queue:retry 실패한 큐 재실행
php artisan schedule:run 등록된 스케줄 실행

 

 


 

🔐 인증/보안 관련 (Laravel Breeze, Jetstream 사용 시)

 

명령어 설명
php artisan make:auth (Laravel 6 이하) 기본 인증 스캐폴딩 생성
php artisan breeze:install Laravel Breeze 설치
php artisan jetstream:install Jetstream 설치

 

 


 

💡 Artisan 명령어 팁

 

  • php artisan 만 입력하면 현재 사용 가능한 명령어 전체가 카테고리별로 나옵니다.
  • php artisan 명령어 --help 옵션을 붙이면, 사용 가능한 옵션과 설명을 함께 확인할 수 있어 유용합니다.

 


 

이처럼

 

artisan 을 이용하면

 

데이터베이스 기본 설정 부터, 샘플 데이터 입력,

 

컨트롤러 및 모델 생성 등

 

전체적으로 프로젝트를 관리할 수 있어서 너무 편합니다!

 

저도 아직 적응단계이긴 하지만,

 

더 잘 사용할 수 있는 노하우가 생기는대로 

 

공유하겠습니다!

 

도움이 되셨다면, 구독/공감/댓글 부탁드립니다!

 

감사합니다!

반응형
Comments