# IPcalc-u-later ## Overview **IPcalc-u-later** is a web application that calculates information about an IP subnet. Given an IPv4 or IPv6 address and subnet mask in CIDR notation (e.g., `213.136.12.128/27`), the application will return the following information: - **Network Address** - **First IP Address** - **Last IP Address** - **Number of Usable Hosts** This application is built using the **MVC (Model-View-Controller)** design pattern, without relying on any PHP frameworks, to meet the challenge requirements. The back-end is developed in PHP, and the user interface is created using HTML, TailwindCSS, TypeScript and Vue. ### Example Inputs and Outputs: #### IPv4 Example: - **Input**: `213.136.12.128/27` - **Output**: - Network: `213.136.12.128` - First: `213.136.12.129` - Last: `213.136.12.158` - Hosts: `30` #### IPv6 Example: - **Input**: `2001:db8:85a3:8a2e::/64` - **Output**: - Network: `2001:0db8:85a3:8a2e::` - First: `2001:0db8:85a3:8a2e:0000:0000:0000:0000` - Last: `2001:0db8:85a3:8a2e:ffff:ffff:ffff:ffff` - Hosts: `18446744073709551616` ## Features - **Back-end**: - MVC architecture (without using a framework) - IP address information and calculation logic implemented in PHP - Supports both IPv4 and IPv6 - Validation for invalid subnet input - Self-written PHP classes for IP address calculations - **Front-end**: - Simple, responsive design using HTML, TailwindCSS, TypeScript and Vue - Input field to enter the subnet - Displays the result in a user-friendly format - **Extras** (Optional Features): - Optionally, uses a template engine for rendering views (Vue) - Optionally, third-party PHP libraries via Composer - Version control using Git ## Requirements ### Server-side - PHP 8.3+ (or higher) for processing the back-end logic - A web server like Apache or Nginx to host the PHP application - Composer (for managing third-party PHP libraries, if used) ### Client-side - **Node.js**: Version **20** or higher for front-end development - **Yarn**: Version **1.22** or higher for managing JavaScript dependencies. - **Any modern web browser**: Chrome, Firefox, Safari, etc. ## Installation and Setup 1. **Clone the repository**: ```bash git clone cd ipcalc-u-later 2. **Install PHP dependencies**: ```bash composer install 3. **Set up Node.js and Yarn (for front-end development)**: - Install Node.js (ensure you're using version 20 or higher) - You can download and install the latest version from Node.js [official site](https://nodejs.org/en). - Install Yarn globally via npm (if not already installed): ```bash npm install -g yarn 4. **Install frontend dependencies** ```bash yarn install 5. **Setup the server**: - If you're using Apache, ensure that mod_rewrite is enabled and the .htaccess file is properly configured. - If you're using Nginx, configure the server block to point to the public directory. 6. **Run the server**: ```bash php -S localhost:8000 -t public 7. **Acces the application**: - Open a web browser and navigate to http://localhost:8000 (or the appropriate URL based on your server configuration). ## Licence This project is licensed under the MIT License ## Acknowledgements - The MVC design pattern was used to structure the application. - This project was developed as part of a technical challenge.