Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License Version Stars

My Cinema Logo

My Cinema

Back-office for cinema management | Epitech project · PHP MVC + Vue 3 + MySQL

🇬🇧 English · 🇫🇷 Français

Table of Contents
  1. What is this?
  2. Features
  3. Built With
  4. How It Works
  5. Prerequisites
  6. Installation
  7. Configuration
  8. Usage
  9. Project Structure
  10. Architecture
  11. License

What is this?

My Cinema is a back-office web application for cinema managers. It provides a complete administration interface to manage movies, screening rooms, and showtime schedules. Built as an Epitech project, it implements a custom MVC architecture in PHP without any framework, following best practices for security (prepared statements, input validation) and object-oriented design.

Features

  • Movie management — Full CRUD for movies with title, director, genre, duration, and release year. Movies with existing screenings are protected from deletion.
  • Room management — Create, edit, and soft-delete screening rooms. Each room has a name, capacity, and type (Standard, 3D, IMAX).
  • Screening scheduling — Schedule film screenings in specific rooms at specific times. Automatic conflict detection prevents double-booking and overlapping screenings based on movie duration.
  • REST API — Complete JSON API with 15 endpoints covering all CRUD operations for movies, rooms, and screenings.
  • Modern dashboard — Single-page application built with Vue 3 and shadcn-vue components, featuring dark/light theme, responsive tables, and form validation.

Built With

  • PHP — Backend runtime (8.3+)
  • Vue.js — Frontend framework
  • MySQL — Relational database
  • TailwindCSS — Utility-first CSS framework
  • Vite — Frontend build tool
  • Composer — PHP dependency manager

(back to top)

How It Works

graph LR
    A[Vue 3 SPA] -->|fetch /api/*| B[index.php]
    B --> C[Router]
    C --> D[MoviesController]
    C --> E[RoomsController]
    C --> F[ScreeningsController]
    D --> G[Model]
    E --> G
    F --> G
    G -->|PDO| H[(MySQL)]
    G -->|JSON| C
    C -->|JSON Response| A
Loading

The frontend Vue 3 SPA communicates with the backend through fetch() calls to REST API endpoints. The backend's single entry point (index.php) routes requests to the appropriate controller, which validates input, calls the model layer, and returns JSON responses. Models use PDO with prepared statements for all database operations.

(back to top)

Prerequisites

  • PHP 8.3 or higher
  • MySQL 8.0 or higher
  • Composer (PHP dependency manager)
  • Node.js 18+ and npm

(back to top)

Installation

  1. Clone the repository:

    git clone https://github.com/Sofian-bll/ept-my-cinema.git
    cd my-cinema
  2. Install PHP dependencies:

    cd backend
    composer install
  3. Install frontend dependencies:

    cd ../frontend
    npm install
  4. Create the database:

    mysql -u root -p < ../backend/database/schema.sql

    Optionally, seed with sample data:

    mysql -u root -p < ../backend/database/seed.sql

(back to top)

Configuration

  1. Copy the environment file in the backend directory:

    cd backend
    cp .env.example .env
  2. Edit .env with your database credentials:

    APP_ENV=dev
    DB_HOST=localhost
    DB_NAME=my_cinema
    DB_USER=root
    DB_PASS=your_password

(back to top)

Usage

Start the backend (PHP built-in server):

cd backend
php -S localhost:8000 -t public

Start the frontend (Vite dev server):

cd frontend
npm run dev

Open http://localhost:5173 in your browser. The dashboard provides:

  • Dashboard — Overview of the cinema
  • Movies — Add, edit, and delete films
  • Rooms — Manage screening rooms and their types
  • Screenings — Schedule and manage film showtimes
  • Settings — Application preferences

API Endpoints

Method Endpoint Description
GET /api/movies List all movies
GET /api/movies/{id} Get movie details with screenings
POST /api/movies Create a movie
PUT /api/movies/{id} Update a movie
DELETE /api/movies/{id} Delete a movie
GET /api/rooms List all rooms
GET /api/rooms/{id} Get room details
POST /api/rooms Create a room
PUT /api/rooms/{id} Update a room
DELETE /api/rooms/{id} Soft-delete a room
GET /api/screenings List all screenings
GET /api/screenings/{id} Get screening details
POST /api/screenings Create a screening
PUT /api/screenings/{id} Update a screening
DELETE /api/screenings/{id} Delete a screening

(back to top)

Project Structure

my-cinema/
├── backend/
│   ├── app/
│   │   ├── Controllers/     # Request handlers (Movies, Rooms, Screenings)
│   │   ├── Core/            # Router, Database, Model base, Controller base
│   │   ├── Helpers/         # Validation, Date utilities
│   │   ├── Models/          # Entity classes (Movies, Rooms, Screenings)
│   │   └── Traits/          # SoftDelete behavior
│   ├── config/              # Routes and database configuration
│   ├── database/
│   │   ├── schema.sql       # Database schema
│   │   └── seed.sql         # Sample data
│   ├── public/
│   │   └── index.php        # Single entry point
│   ├── tests/               # PHPUnit tests
│   └── composer.json
├── frontend/
│   ├── src/
│   │   ├── components/      # Vue components (ui, layout, movies, rooms, screenings)
│   │   ├── pages/           # Page components (Dashboard, Movies, Rooms, Screenings)
│   │   ├── router/          # Vue Router configuration
│   │   └── assets/          # CSS styles
│   ├── package.json
│   └── vite.config.js
├── docs/
│   └── assets/
│       └── logo.png
├── LICENSE
└── .gitignore

(back to top)

Architecture

The backend follows a custom MVC pattern without any PHP framework:

  • Entry point: backend/public/index.php — All requests are routed through this single file
  • Router: Core/Router.php — Matches URL patterns and HTTP methods to controller actions
  • Controllers: Handle request/response logic, validate input, call models
  • Models: Extend Core/Model.php — Provide PDO-based CRUD operations with prepared statements
  • Traits: SoftDeleteTrait — Implements soft delete for rooms (preserves data with a deleted timestamp)
  • Error handling: Centralized error handler with JSON error responses

All business logic is server-side. The frontend is a thin Vue 3 SPA that consumes the REST API — no business logic in JavaScript.

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Releases

Packages

Contributors

Languages