Laravel
Get expert guidance on Laravel 12.x application development, from foundational concepts like routing and database migrations to advanced patterns including Eloquent relationships, API design, and authentication with Sanctum. This skill covers the full development lifecycle—models, validation, queues, dependency injection, and best practices for building scalable web applications.
Laravel skill provides comprehensive guidance on Laravel 12.x development, including routing, Eloquent ORM, migrations, and API building.
AI-generated summary based on this skill's SKILL.md
Install
rawveg/skillsforge-marketplace/laravel · repository language: Python
git clone https://github.com/rawveg/skillsforge-marketplace
cp -r skillsforge-marketplace ~/.claude/skills/laravelgenerated, unverified - the skill's exact subdirectory could not be determined; check the repository on GitHub
npx skillfed install rawveg/skillsforge-marketplace/laravelFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
What is the Laravel framework and what can I build with it?
Laravel is a PHP web framework designed for building modern web applications and REST APIs. With Laravel, you can create scalable web applications using its comprehensive toolkit that includes routing, middleware, database migrations, Eloquent ORM, authentication, and templating with Blade. Laravel provides a structured approach to development with built-in features for validation, queues, dependency injection, and error handling, making it ideal for both simple websites and complex enterprise applications.
How do Laravel routing and controllers handle requests?
Laravel routing and controllers form the core of request handling. Routes define URL patterns and map them to controller actions, while controllers contain the business logic for processing requests. Laravel's routing system supports HTTP verbs (GET, POST, PUT, DELETE), route parameters, and middleware attachment. Controllers organize related request handling logic, making applications maintainable. Middleware can be applied globally or to specific routes to filter requests before they reach controllers, enabling authentication checks, CORS handling, and other cross-cutting concerns.
What are Laravel database migrations and Eloquent ORM?
Laravel database migrations are version-controlled PHP files that define database schema changes, allowing teams to track and apply database modifications consistently across environments. Eloquent ORM is Laravel's object-relational mapping layer that lets you interact with databases using PHP objects instead of raw SQL. Eloquent supports relationships (one-to-many, many-to-many, etc.), eager loading, query scoping, and provides a fluent query builder. Together, migrations and Eloquent enable efficient database management and querying within Laravel applications.
How do I set up authentication and build REST APIs in Laravel?
Laravel provides multiple authentication options including session-based auth and token-based authentication with Sanctum for API protection. For REST APIs, Laravel offers a structured approach using routes, controllers, and resource classes to define endpoints. Sanctum enables stateless API authentication via tokens, supporting both single-page applications and mobile clients. Laravel's validation, error handling, and response formatting features streamline API development. Best practices include using route model binding, implementing proper HTTP status codes, and leveraging Laravel's built-in features for rate limiting and CORS configuration.
What Laravel best practices should I follow for production applications?
Laravel best practices include using environment configuration files for sensitive data, implementing proper error handling and logging, writing tests with Laravel's testing framework, optimizing queries with eager loading, caching frequently accessed data, and using queues for long-running tasks. Security practices involve validating all user input, using Laravel's built-in protection against CSRF, SQL injection, and XSS attacks, and keeping dependencies updated via Composer. For deployment, use Artisan commands for migrations and cache clearing, implement proper file permissions, and monitor application performance.
What are Laravel Blade templates and Artisan commands?
Laravel Blade is a lightweight templating engine that compiles to plain PHP, providing syntax for control structures, loops, and component reuse without the overhead of complex template languages. Blade supports template inheritance, includes, and directives like @if, @foreach, and @auth. Artisan is Laravel's command-line interface providing built-in commands for common tasks: php artisan migrate runs migrations, php artisan tinker opens an interactive shell, php artisan make:controller generates controllers, and many others. Custom Artisan commands can be created for application-specific tasks, automating repetitive development workflows.