A webpage with a MVC back-end without using a framework in which a subnet (IP) can be entered via a text field, resulting in info about the subnet: first IP address, last IP address, network address and number of usable hosts.
Find a file
2024-11-25 20:23:45 +01:00
app Initial commit, framework/frontend assets setup 2024-11-25 18:59:11 +01:00
config Initial commit, framework/frontend assets setup 2024-11-25 18:59:11 +01:00
public Env loader 2024-11-25 20:23:45 +01:00
resources Refactor loading vue app 2024-11-25 19:38:04 +01:00
src Env loader 2024-11-25 20:23:45 +01:00
.env.example Env loader 2024-11-25 20:23:45 +01:00
.gitignore Env loader 2024-11-25 20:23:45 +01:00
composer.json Env loader 2024-11-25 20:23:45 +01:00
composer.lock Env loader 2024-11-25 20:23:45 +01:00
global.d.ts Initial commit, framework/frontend assets setup 2024-11-25 18:59:11 +01:00
package-lock.json Initial commit, framework/frontend assets setup 2024-11-25 18:59:11 +01:00
package.json Initial commit, framework/frontend assets setup 2024-11-25 18:59:11 +01:00
postcss.config.cjs Initial commit, framework/frontend assets setup 2024-11-25 18:59:11 +01:00
readme.md Update readme 2024-11-25 19:00:14 +01:00
tailwind.config.js Initial commit, framework/frontend assets setup 2024-11-25 18:59:11 +01:00
vite.config.ts Refactor loading vue app 2024-11-25 19:38:04 +01:00
yarn.lock Initial commit, framework/frontend assets setup 2024-11-25 18:59:11 +01:00

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:

    git clone git@git.maartenvr98.nl:maartenvr98/IPcalc-u-later.git
    cd ipcalc-u-later
    
    
  2. Install PHP dependencies:

    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.
  • Install Yarn globally via npm (if not already installed):
    npm install -g yarn
    
    
  1. Install frontend dependencies

    yarn install
    
    
  2. 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.
  1. Run the server:

    php -S localhost:8000 -t public
    
    
  2. 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.