{"id":19035190,"url":"https://github.com/zahidrahimoon/phpoop","last_synced_at":"2025-08-16T08:23:34.984Z","repository":{"id":253630557,"uuid":"844072844","full_name":"zahidrahimoon/PHPOOP","owner":"zahidrahimoon","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-18T17:20:10.000Z","size":18,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-19T11:27:47.383Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zahidrahimoon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-18T09:50:17.000Z","updated_at":"2024-08-18T19:40:09.000Z","dependencies_parsed_at":"2024-08-18T11:14:42.364Z","dependency_job_id":null,"html_url":"https://github.com/zahidrahimoon/PHPOOP","commit_stats":null,"previous_names":["zahidrahimoon/phpoop"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahidrahimoon%2FPHPOOP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahidrahimoon%2FPHPOOP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahidrahimoon%2FPHPOOP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zahidrahimoon%2FPHPOOP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zahidrahimoon","download_url":"https://codeload.github.com/zahidrahimoon/PHPOOP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223759876,"owners_count":17197861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T21:49:32.411Z","updated_at":"2024-11-08T21:49:32.890Z","avatar_url":"https://github.com/zahidrahimoon.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📦 INVENTARY MANAGEMENT SYSTEM\n\n![PHP Version](https://img.shields.io/badge/PHP-%3E%3D%207.4-777bb3.svg?style=flat-square\u0026logo=php\u0026logoColor=white)\n![PDO](https://img.shields.io/badge/PDO-Enabled-green.svg?style=flat-square)\n![MySQL](https://img.shields.io/badge/MySQL-%3E%3D%205.7-4479A1.svg?style=flat-square\u0026logo=mysql\u0026logoColor=white)\n\n## 📋 Overview\n\nThis project is a CRUD (Create, Read, Update, Delete) application built using **PHP Data Objects (PDO)** with **Object-Oriented Programming (OOP)** principles. The application manages a simple inventory system by interacting with a MySQL database, handling basic product information like name, description, price, and quantity.\n\n## 🛠️ Features\n\n- **Create**: Add new products to the inventory.\n- **Read**: Display all products in a tabular format.\n- **Update**: Edit product details.\n- **Delete**: Remove products with a confirmation prompt.\n\n## 📂 File Structure\n\n```bash\n.\n├── config/\n│   └── db.php           # Database connection file\n├── crud/\n│   ├── create.php       # Create product page\n│   ├── delete.php       # Delete product page\n│   ├── Product.php      # Product class with CRUD methods\n│   ├── read.php         # Read products page\n│   └── update.php       # Update product page\n├── index.php            # Main page to list all products\n└── README.md            # Project documentation (this file)\n```\n\n## 🗂️ Database Setup\n\n### 1. Create Database\n\nFirst, create a MySQL database named `inventory`:\n\n```sql\nCREATE DATABASE inventory;\n```\n\n### 2. Create `products` Table\n\nRun the following SQL script to create the `products` table:\n\n```sql\nUSE inventory;\n\nCREATE TABLE `products` (\n    `id` INT AUTO_INCREMENT PRIMARY KEY,\n    `name` VARCHAR(100) NOT NULL,\n    `description` TEXT,\n    `price` DECIMAL(10,2) NOT NULL,\n    `quantity` INT NOT NULL,\n    `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n);\n```\n\n## 🚀 Getting Started\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/zahidrahimoon/PHPOOP.git\ncd PHPOOP\n```\n\n### 2. Setup Database Connection\n\nNavigate to `config/db.php` and update the database credentials:\n\n```php\n\u003c?php\nclass Database {\n    private $host = 'localhost';\n    private $db_name = 'inventory';\n    private $username = 'root';\n    private $password = '';\n    private $conn;\n\n    public function connect() {\n        $this-\u003econn = null;\n\n        try {\n            $this-\u003econn = new PDO(\"mysql:host={$this-\u003ehost};dbname={$this-\u003edb_name}\", $this-\u003eusername, $this-\u003epassword);\n            $this-\u003econn-\u003esetAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);\n        } catch (PDOException $e) {\n            echo 'Connection Error: ' . $e-\u003egetMessage();\n        }\n\n        return $this-\u003econn;\n    }\n}\n```\n\n### 3. Run the Application\n\n- Start your local server (e.g., using XAMPP, MAMP, or LAMP).\n- Access the application by navigating to `http://localhost/PHPOOP/index.php` in your browser.\n\n## 🔧 CRUD Operations\n\n### Create\n\nTo add a new product:\n- Navigate to `http://localhost/PHPOOP/crud/create.php`.\n- Fill in the product details and submit the form.\n\n### Read\n\nTo view all products:\n- Navigate to `http://localhost/PHPOOP/index.php`.\n\n### Update\n\nTo update a product:\n- Click on the `Edit` button for the desired product on the main page.\n- Make necessary changes and submit the form.\n\n### Delete\n\nTo delete a product:\n- Click on the `Delete` button for the desired product on the main page.\n- Confirm the deletion to remove the product from the database.\n\n## 🧩 Classes and Methods\n\n### Database Class\n\n- **Properties**:\n  - `$host`: Database host.\n  - `$db_name`: Database name.\n  - `$username`: Database username.\n  - `$password`: Database password.\n  - `$conn`: Connection variable.\n\n- **Methods**:\n  - `connect()`: Establishes and returns the PDO connection.\n\n### Product Class\n\n- **Properties**:\n  - `$id`: Product ID.\n  - `$name`: Product name.\n  - `$description`: Product description.\n  - `$price`: Product price.\n  - `$quantity`: Product quantity.\n\n- **Methods**:\n  - `create()`: Inserts a new product into the database.\n  - `read()`: Fetches all products from the database.\n  - `update()`: Updates the product information.\n  - `delete()`: Deletes a product from the database.\n\n## 📝 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzahidrahimoon%2Fphpoop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzahidrahimoon%2Fphpoop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzahidrahimoon%2Fphpoop/lists"}