Giter Site home page Giter Site logo

ljubomirs / carty-craft Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 23 KB

Carty-Craft utilizes OOP, MySQL, PDO, and Composer to build an online shopping platform with CRUD functionality. Session management stored cart state, and a comprehensive README file showcased best documentation practices. In this project, I focused on applying mentioned concepts in a real-world scenario.

PHP 99.47% Hack 0.53%
oop composer crud mysql pdo php session

carty-craft's Introduction

Carty-Craft

This project is a web application that contains some features of online shopping. With this application, users will be able to create, read, update, and delete products, view the product catalog, add products to the cart, view the products added to the cart where they can update the quantities or remove products, view the checkout page where they can see the summary of their order and a button to complete the order, and view a page containing all completed orders.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

For this project, you will need to set up a local development environment using XAMPP, MAMP, or a similar local server provider. XAMPP and MAMP are both free and open-source, and are popular choices for setting up a local development environment. They include a web server, a database, and other tools that developers need for creating and managing websites. Both packages are easy to install and set up, so you can get started quickly with creating your project.

In addition, you will also need to have Composer installed on your local machine. Composer is a dependency manager for PHP that is used to manage dependencies and libraries in your project.

Once you have installed XAMPP or MAMP and Composer, you can proceed with setting up the project as described below.

XAMPP

Composer

Installation

  1. Begin by setting up Git on your local machine. To do this, go to the official Git website and download the latest version of the software. GIT

  2. Navigate to the folder where you want to store the project.

  3. Go to the project page on GitHub. On the project page, you will see a button <> CODE and a section labeled "SSH" inside with a long string of numbers and letters. Copy this SSH address to your clipboard. You will need this address in the next step.

  4. Type the command β€œgit clone [SSH address]” in Git Bash. This will download the project from GitHub onto your local machine.

  5. Start Apache and MySQL in XAMPP (if not started already)

  6. Navigate to Carty-Craft in Git Bash

  7. Execute 'create_tables.php' file inside database folder. Do it by typing command: php database/create_tables.php

    This code is a PHP script that creates a database and adds products to a 'products' table. It first reads an SQL file which is located in the same folder as this code and contains the necessary commands to create the database. Then, it establishes a connection to the database using a PDO (PHP Data Object). After that, it prompts the user if they would like to re-create the database. Finally, it executes the SQL commands from the file to create the database.

  8. Run the command composer install to install the project dependencies.

  9. After that start the server on your local machine by typing: php -S localhost:8888 -t public

    This code is a PHP command that starts a local server on your machine. The php command is used to start the server, and the -S flag is used to specify the hostname and port number to use (you can use any available port). The -t flag is used to specify the document's root directory, which is the 'public' folder in this case. This command will start a local server which can be accessed at http://localhost:8888.

  10. Go to your browser and type 'http://localhost:8888' to access the app

  11. Explore the app and enjoy

Relevant Information

If you choose port other than 8888, you need to change that in the app, in 'src\Action\CartActions\AddToCartAction.php' file: match ($_SERVER['HTTP_REFERER']) { "http://localhost:[type your port here]/index.php?action=catalog" => header('Location: /index.php?action=catalog'), "http://localhost:[type your port here]/index.php?action=cart" => header('Location: /index.php?action=cart') };

carty-craft's People

Contributors

ljubomirs avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.