Cinema System API is a comprehensive RESTful API developed as part of the SoftServe practice program. The API serves as the backend for a cinema management system, allowing users to browse movies, check session availability, and book seats. Built primarily with PHP, it provides a robust foundation for cinema applications.
- List Movies: Get a paginated list of all available movies
- Movie Details: Retrieve comprehensive information about specific movies
- Search & Filter: Find movies by title, genre, release date, or rating
- Categories: Browse movies by categories and collections
- Available Sessions: List all upcoming movie sessions
- Session Details: Get detailed information about specific sessions
- Schedule: Browse sessions by date, time, and cinema hall
- Seat Layout: Retrieve the layout and availability of seats for each session
- Seat Reservation: Reserve seats for a specific movie session
- Booking Confirmation: Complete the booking process
- Booking History: Retrieve user's past bookings
- Ticket Generation: Generate digital tickets for confirmed bookings
- Authentication: Secure login and registration system
- User Profiles: Manage user information and preferences
- Role-Based Access: Different permission levels for regular users and administrators
- Backend: PHP 8.0+
- Database: MySQL/MariaDB
- API Architecture: RESTful design principles
- Authentication: JWT (JSON Web Tokens)
- Documentation: OpenAPI/Swagger
- Testing: PHPUnit
The API is fully documented using OpenAPI/Swagger specifications. Access the interactive documentation at:
/api/docs
# Movies
GET /api/movies # List all movies
GET /api/movies/{id} # Get movie details
GET /api/movies/search?q={term} # Search for movies
# Sessions
GET /api/sessions # List all sessions
GET /api/sessions/{id} # Get session details
GET /api/sessions/movie/{id} # Get sessions for a specific movie
# Bookings
POST /api/bookings # Create a new booking
GET /api/bookings/{id} # Get booking details
GET /api/bookings/user/{id} # Get user's bookings
DELETE /api/bookings/{id} # Cancel booking
# Authentication
POST /api/auth/register # Register new user
POST /api/auth/login # Login user
POST /api/auth/refresh # Refresh access token
- PHP 8.0 or higher
- Composer
- MySQL/MariaDB database
- Web server (Apache/Nginx)
-
Clone the repository
git clone https://github.com/amormul/API-Practice-SoftServe.git cd API-Practice-SoftServe -
Install dependencies
composer install
-
Set up environment variables
cp .env.example .env # Edit the .env file with your database credentials and other configuration -
Set up the database
php artisan migrate php artisan db:seed # Optional: Populate with sample data -
Start the development server
php -S localhost:8000 -t public
-
Access the API
Open http://localhost:8000/api in your browser or API client
The API can be configured through the .env file:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=cinema_api
DB_USERNAME=root
DB_PASSWORD=
JWT_SECRET=your_jwt_secret_key
JWT_TTL=60 # Token time-to-live in minutes
PAGINATION_LIMIT=15
src/
├── Controllers/ # API endpoint controllers
├── Models/ # Data models and database interactions
├── Middleware/ # Request middleware components
├── Services/ # Business logic services
├── Repositories/ # Data access layer
├── Routes/ # API route definitions
├── Helpers/ # Utility functions and helpers
├── Config/ # Configuration files
├── Database/
│ ├── Migrations/ # Database structure migrations
│ └── Seeders/ # Sample data seeders
└── Tests/ # API endpoint tests
Run the automated tests with:
composer testOr for more detailed output:
vendor/bin/phpunit --testdoxThis API implements several security best practices:
- JWT-based authentication
- Input validation and sanitization
- CORS policy configuration
- Rate limiting
- SQL injection prevention
- XSS protection
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- SoftServe mentors and instructors for their guidance and support
- All contributors who helped improve this API
- Open-source community for providing excellent tools and libraries
Developed with ❤️ by amormul — Last updated: June 8, 2025