This is an old revision of the document!
Table of Contents
Senior PHP/Laravel Backend Interview Questions
PHP / Laravel / Symfony
PHP Fundamentals
1. What are PSR standards and why do they matter?
2. What new PHP features have you used in PHP 8.x?
3. How does Composer autoloading work?
4. What is the difference between interface, abstract class, and trait?
5. What are attributes in PHP and when would you use them?
6. How does PHP-FPM work?
7. How does OPCache improve performance?
8. What are common memory issues in PHP applications?
Laravel & Symfony
9. How does Laravel's service container work?
10. What are Laravel service providers?
11. How does dependency injection work in Laravel?
12. How do you handle long-running tasks in Laravel?
13. How does Laravel Queue work?
14. Explain Laravel Events and Listeners.
15. Explain Laravel Middleware.
16. How does Eloquent ORM work internally?
17. What are the advantages and disadvantages of Eloquent vs Query Builder?
18. Explain Symfony's Dependency Injection component.
19. What is the Symfony Event Dispatcher?
20. Which Laravel version are you currently using? Which Symfony version are you currently using?
REST API Design
21. What are the common HTTP methods used in REST APIs and what do they mean?
22. What is the difference between HTTP 401 and HTTP 403?
23. What are some other important HTTP status codes?
24. How do you version APIs?
25. How do you handle pagination?
26. How do you design APIs for web, mobile, and third-party consumers?
27. What are idempotent APIs?
28. How do you design a scalable RESTful API?
Database
Database Fundamentals
1. What are database indexes and what are their trade-offs?
2. What is a clustered index?
3. What is a covering index?
4. What is the difference between B-Tree and Hash indexes?
5. What is normalization and denormalization?
6. When would you choose PostgreSQL over MySQL?
7. What are the advantages of PostgreSQL JSONB?
Query Optimization
8. How do you optimize a slow MySQL query?
9. What is the N+1 query problem and how do you fix it?
10. How do you analyze a query using EXPLAIN?
11. How do you identify database bottlenecks?
12. How would you optimize a query serving millions of rows?
13. What causes table locking issues?
14. How do you optimize bulk inserts and updates?
Transactions & Consistency
15. What are ACID properties?
16. What are database isolation levels?
17. What is the difference between pessimistic and optimistic locking?
18. What are deadlocks and how do you resolve them?
19. What is eventual consistency and when is it acceptable?
20. How would you design a highly concurrent booking system?
Security
Authentication & Authorization
1. What are the three parts of a JWT? What is the purpose of each part?
2. What is the difference between an Access Token and a Refresh Token?
3. OAuth2 vs JWT: what is the difference?
4. What is RBAC (Role-Based Access Control)?
5. How would you implement authorization in Laravel?
6. What is the principle of least privilege?
Web Security
7. What is CORS and why do browsers need it?
8. What is the difference between a simple request and a preflight request?
9. What are the important CORS response headers?
10. Why can't Access-Control-Allow-Origin: * be used with credentials?
11. How do you configure CORS in Laravel?
12. How do you configure CORS in Symfony?
13. Does CORS prevent attacks? How does CORS relate to security?
14. What is CSRF and how does Laravel protect against it?
15. What is XSS and how can it be prevented?
16. What is SQL Injection and how can it be prevented?
17. What is SSRF?
18. What is rate limiting and how would you implement it?
19. What security risks exist in file uploads?
20. What are the OWASP Top 10 risks?
Architecture & Design Patterns
SOLID & Clean Code
1. Explain the five SOLID principles.
2. Can you give an example of violating the Dependency Inversion Principle and how to fix it?
3. What is Clean Architecture?
4. What is Hexagonal Architecture?
5. What is Domain-Driven Design (DDD)?
6. What coding practices help maintain large codebases?
Design Patterns
7. Which creational design patterns have you used in PHP/Laravel projects?
8. Which structural design patterns have you used in PHP/Laravel projects?
9. Which behavioral design patterns have you used in PHP/Laravel projects?
10. What design patterns do you use most frequently in PHP projects?
11. When would you use Strategy Pattern?
12. When would you use Factory Pattern?
13. When would you use Repository Pattern?
14. What are the drawbacks of Repository Pattern?
Scalability
15. How do you approach breaking a monolithic application into services?
16. How would you design a system serving millions of requests per day?
17. What scalability challenges would you expect in a multi-tenant SaaS platform?
18. How would you implement caching?
19. Redis: when would you use it?
20. What are cache invalidation strategies?
Messaging, Queue & Event-Driven Systems
1. How does Laravel Queue work?
2. Why use a queue instead of synchronous processing?
3. What queue backends have you used?
4. What is the difference between a job and an event?
5. What is the difference between a message queue and an event stream?
6. When would you use Kafka?
7. When would you use RabbitMQ?
8. How do you handle retries and dead-letter queues?
9. How do you ensure idempotency in asynchronous systems?
Testing
1. What is the difference between unit, integration, and functional tests?
2. What is the difference between a Mock, a Stub, and a Fake?
3. How do you test code that depends on external APIs?
4. What code coverage percentage do you target and why?
5. How do you test Laravel jobs and queues?
6. How do you test event-driven systems?
7. What is contract testing?
8. What should and should not be mocked?
DevOps & AWS
CI/CD
1. Describe your ideal CI/CD pipeline for a PHP project.
2. What is the difference between blue-green deployment and canary deployment?
3. How do you manage environment-specific configuration securely?
4. How do you handle database migrations in production?
5. How do you roll back a failed deployment?
AWS
6. Which AWS services are commonly used in a PHP backend architecture?
7. When would you use ECS vs EKS?
8. How do you store secrets securely in AWS?
9. What is CloudFront?
10. What is SQS?
11. What is EventBridge?
12. What is RDS Proxy?
13. How would you build a highly available architecture on AWS?
Packages & Ecosystem
1. How does Composer resolve dependencies?
2. What is semantic versioning?
3. How do you evaluate whether a package is safe to use?
4. How do you handle package vulnerabilities?
5. What Laravel packages do you use most often?
6. How do you create your own Composer package?
7. How do you version and maintain internal packages?
8. What are the risks of overusing third-party packages?
9. How would you share code between multiple PHP services?
Leadership & Mentorship
1. How do you conduct effective code reviews?
2. How do you enforce coding standards across a team?
3. How do you handle a junior developer who keeps repeating the same mistakes?
4. How do you communicate a technical decision to a non-technical stakeholder?
5. How do you mentor developers?
6. How do you resolve technical disagreements within a team?
Agile & Incident Management
1. How do you estimate tasks during sprint planning?
2. How do you handle critical production incidents?
3. What is your incident response process?
4. How do you perform root cause analysis?
5. What metrics do you track for engineering teams?
Bonus
1. What is GraphQL and when would you use it instead of REST?
2. What is gRPC and when would you use it?
3. REST vs GraphQL vs gRPC?
4. What is OpenTelemetry?
5. What are the key observability pillars?
6. How would you monitor a production PHP system?
