├── .gitignore ├── .vscode └── settings.json ├── configuration ├── custom-functions.php ├── connection.php └── functions.php ├── file-upload-example.html ├── delete.php ├── create.php ├── update.php ├── read.php ├── file-upload.php └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | configuration -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": ["Imdadullah"] 3 | } 4 | -------------------------------------------------------------------------------- /configuration/custom-functions.php: -------------------------------------------------------------------------------- 1 | connect_error) { 21 | die("Connection failed: " . $conn->connect_error); 22 | } 23 | -------------------------------------------------------------------------------- /file-upload-example.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | File Upload Page 7 | 8 | 9 |
10 | 11 |
17 | 18 | 19 |
25 | 26 | 27 |
28 | 29 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /delete.php: -------------------------------------------------------------------------------- 1 | 'error', 'message' => 'Invalid request method or content type']); 22 | exit; 23 | } 24 | 25 | // Disable autocommit for database transactions 26 | $conn->autocommit(false); 27 | 28 | try { 29 | // Decode JSON data from request body 30 | $requestData = json_decode(file_get_contents('php://input'), true, 512, JSON_THROW_ON_ERROR); 31 | 32 | // Check if 'table' parameter exists in the request data 33 | if (!isset($requestData['table'])) { 34 | throw new Exception('Missing required parameters: table'); 35 | } 36 | 37 | // Check if 'conditions' parameter exists in the request data 38 | if (!isset($requestData['conditions'])) { 39 | throw new Exception('Missing required parameters: conditions'); 40 | } 41 | 42 | // Prepare SQL query for deletion 43 | $table = $requestData['table']; 44 | $conditions = buildWhereClause($conn, $requestData['conditions']); 45 | 46 | $sql = "DELETE FROM $table $conditions"; 47 | 48 | // Execute the SQL query 49 | $result = $conn->query($sql); 50 | 51 | // If query executed successfully, commit transaction and return success response 52 | if ($result) { 53 | $conn->commit(); 54 | http_response_code(200); 55 | echo json_encode(['status' => 'success', 'message' => 'Data deleted successfully']); 56 | } else { 57 | throw new Exception('Delete query failed'); 58 | } 59 | } catch (Exception $e) { 60 | // Rollback the transaction on any exception 61 | $conn->rollback(); 62 | http_response_code(500); 63 | echo json_encode(['status' => 'error', 'message' => $e->getMessage()]); 64 | } finally { 65 | // Close the database connection 66 | $conn->close(); 67 | } 68 | -------------------------------------------------------------------------------- /create.php: -------------------------------------------------------------------------------- 1 | 'error', 'message' => 'Invalid request method or content type']); 22 | exit; 23 | } 24 | 25 | // Disable autocommit for database transactions 26 | $conn->autocommit(false); 27 | 28 | try { 29 | // Decode JSON data from request body 30 | $requestData = json_decode(file_get_contents('php://input'), true, 512, JSON_THROW_ON_ERROR); 31 | 32 | // Check if 'table' parameter exists in the request data 33 | if (!isset($requestData['table'])) { 34 | throw new Exception('Missing required parameters: table'); 35 | } 36 | 37 | // Check if 'data' parameter exists in the request data 38 | if (!isset($requestData['data'])) { 39 | throw new Exception('Missing required parameters: data'); 40 | } 41 | 42 | // Perform validation if 'validation' parameter exists in the request data 43 | if (isset($requestData['validation'])) { 44 | $validationResult = validateData($requestData['data'][0], $requestData['validation'][0], $conn, $requestData['table'], $conditions = []); 45 | if ($validationResult !== null) { 46 | throw new Exception($validationResult); 47 | } 48 | } 49 | 50 | // Prepare SQL query for insertion 51 | $table = $requestData['table']; 52 | $columns = implode(',', array_keys($requestData['data'][0])); 53 | $values = []; 54 | foreach ($requestData['data'] as $item) { 55 | $values[] = "'" . implode("','", $item) . "'"; 56 | } 57 | $valuesString = implode('),(', $values); 58 | $sql = "INSERT INTO $table ($columns) VALUES ($valuesString)"; 59 | 60 | // Execute the SQL query 61 | $result = $conn->query($sql); 62 | 63 | // If query executed successfully, commit transaction and return success response 64 | if ($result) { 65 | $conn->commit(); 66 | http_response_code(201); 67 | echo json_encode(['status' => 'success', 'message' => 'Data inserted successfully']); 68 | } else { 69 | // If query failed, throw an exception 70 | throw new Exception('Query failed'); 71 | } 72 | } catch (Exception $e) { 73 | // Rollback transaction in case of exception and return error response 74 | $conn->rollback(); 75 | http_response_code(500); 76 | echo json_encode(['status' => 'error', 'message' => $e->getMessage()]); 77 | } finally { 78 | // Close database connection 79 | $conn->close(); 80 | } 81 | -------------------------------------------------------------------------------- /update.php: -------------------------------------------------------------------------------- 1 | 'error', 'message' => 'Invalid request method or content type']); 22 | exit; 23 | } 24 | 25 | // Disable autocommit for database transactions 26 | $conn->autocommit(false); 27 | 28 | try { 29 | // Decode JSON data from request body 30 | $requestData = json_decode(file_get_contents('php://input'), true, 512, JSON_THROW_ON_ERROR); 31 | 32 | // Check if 'table' parameter exists in the request data 33 | if (!isset($requestData['table'])) { 34 | throw new Exception('Missing required parameters: table'); 35 | } 36 | 37 | // Check if 'data' parameter exists in the request data 38 | if (!isset($requestData['data'])) { 39 | throw new Exception('Missing required parameters: data'); 40 | } 41 | 42 | // Check if 'conditions' parameter exists in the request data 43 | if (!isset($requestData['conditions'])) { 44 | throw new Exception('Missing required parameters: conditions'); 45 | } 46 | 47 | // Perform validation if 'validation' parameter exists in the request data 48 | if (isset($requestData['validation'])) { 49 | $validationResult = validateData($requestData['data'][0], $requestData['validation'][0], $conn, $requestData['table'], $requestData['conditions']); 50 | if ($validationResult !== null) { 51 | throw new Exception($validationResult); 52 | } 53 | } 54 | 55 | // Prepare SQL query for insertion 56 | $table = $requestData['table']; 57 | $dataToUpdate = $requestData['data'][0]; 58 | $conditions = isset($requestData['conditions']) ? buildWhereClause($conn, $requestData['conditions']) : ''; 59 | 60 | $values = []; 61 | foreach ($dataToUpdate as $column => $value) { 62 | $values[] = "$column = '$value'"; 63 | } 64 | $setValues = implode(', ', $values); 65 | 66 | $sql = "UPDATE $table SET $setValues $conditions"; 67 | 68 | // Execute the SQL query 69 | $result = $conn->query($sql); 70 | 71 | // If query executed successfully, commit transaction and return success response 72 | if ($result) { 73 | $conn->commit(); 74 | http_response_code(201); 75 | echo json_encode(['status' => 'success', 'message' => 'Data updated successfully', 's' => $sql]); 76 | } else { 77 | // If query failed, throw an exception 78 | throw new Exception('Query failed'); 79 | } 80 | } catch (Exception $e) { 81 | // Rollback transaction in case of exception and return error response 82 | $conn->rollback(); 83 | http_response_code(500); 84 | echo json_encode(['status' => 'error', 'message' => $e->getMessage()]); 85 | } finally { 86 | // Close database connection 87 | $conn->close(); 88 | } 89 | -------------------------------------------------------------------------------- /read.php: -------------------------------------------------------------------------------- 1 | 'error', 'message' => 'Invalid request method or content type']); 22 | exit; 23 | } 24 | 25 | // Disable autocommit for database transactions 26 | $conn->autocommit(false); 27 | 28 | try { 29 | // Decode JSON data from request body 30 | $requestData = json_decode(file_get_contents('php://input'), true, 512, JSON_THROW_ON_ERROR); 31 | 32 | // Check if 'table' parameter exists in the request data 33 | if (!isset($requestData['table'])) { 34 | throw new Exception('Missing required parameters: table'); 35 | } 36 | 37 | // Check if 'select' parameter exists in the request data 38 | if (!isset($requestData['select'])) { 39 | throw new Exception('Missing required parameters: select'); 40 | } 41 | 42 | // Prepare SQL query for selection 43 | $table = $requestData['table']; 44 | $select = implode(',', $requestData['select']); 45 | $join = ''; 46 | if (isset($requestData['join'])) { 47 | foreach ($requestData['join'] as $joinClause) { 48 | $joinTable = $joinClause['table']; 49 | $joinOn = $joinClause['on']; 50 | $joinType = strtoupper($joinClause['type']); 51 | $join .= " $joinType JOIN $joinTable ON $joinOn[0] = $joinOn[1]"; 52 | } 53 | } 54 | 55 | // Check if both conditions passed, build where conditions 56 | $conditions = isset($requestData['conditions']) ? buildWhereClause($conn, $requestData['conditions']) : ''; 57 | $rawConditions = isset($requestData['rawConditions']) ? implode(' ', $requestData['rawConditions']) : ''; 58 | 59 | // Check if both conditions and rawConditions are passed in the request 60 | if ($conditions && $rawConditions) { 61 | throw new Exception('You cannot pass both conditions or rawConditions in the request, use only one of them'); 62 | } 63 | 64 | // Check if limit and order passed in the request or not 65 | $limit = isset($requestData['limit']) ? 'LIMIT ' . $requestData['limit'] : ''; 66 | $order = isset($requestData['order']) ? 'ORDER BY ' . $requestData['order']['on'] . ' ' . strtoupper($requestData['order']['type']) : ''; 67 | 68 | $sql = "SELECT $select FROM $table $join $conditions $rawConditions $order $limit"; 69 | 70 | // Execute the query 71 | $result = $conn->query($sql); 72 | 73 | // If query executed successfully, commit transaction and return success response 74 | if ($result) { 75 | // Fetch and return the data as JSON 76 | $data = $result->fetch_all(MYSQLI_ASSOC); 77 | http_response_code(200); // OK 78 | echo json_encode(['status' => 'success', 'data' => $data]); 79 | 80 | // Commit the transaction if everything is successful 81 | $conn->commit(); 82 | } else { 83 | // If query failed, throw an exception 84 | throw new Exception('Query failed'); 85 | } 86 | } catch (Exception $e) { 87 | // Rollback the transaction on any exception 88 | $conn->rollback(); 89 | http_response_code(500); 90 | echo json_encode(['status' => 'error', 'message' => $e->getMessage()]); 91 | } finally { 92 | // Close the database connection 93 | $conn->close(); 94 | } 95 | -------------------------------------------------------------------------------- /file-upload.php: -------------------------------------------------------------------------------- 1 | autocommit(false); // disable autocommit 28 | 29 | try { 30 | // Loop through all the FILES available in the request 31 | foreach ($_FILES as $key => $fileData) { 32 | // Get the file extension from the uploaded file 33 | $fileExt = pathinfo($fileData['name'], PATHINFO_EXTENSION); 34 | // Create a filename with the combination of the current date and some random numbers 35 | $fileName = date('Ymd') . rand(11111, 99999) . '.' . $fileExt; 36 | 37 | // Check the extension against the validation array 38 | if (in_array($fileExt, $allowedExtensions)) { 39 | // Create a directory if it does not already exist 40 | if (!is_dir('uploads/' . strtolower($_POST['fileDestination']))) { 41 | mkdir('uploads/' . strtolower($_POST['fileDestination']), 0777, true); 42 | } 43 | // Prepare the destination of the file 44 | $destination = 'uploads/' . strtolower($_POST['fileDestination']) . '/' . $fileName; 45 | // Add the key of the file with the destination path 46 | $response[$key] = $destination; 47 | // Move the uploaded file to the destination 48 | move_uploaded_file($fileData['tmp_name'], $destination); 49 | } else { 50 | // Rollback the transaction in case of validation failure 51 | $conn->rollback(); 52 | http_response_code(400); // Bad Request 53 | echo json_encode(['status' => 'error', 'message' => 'File must be in ' . $_POST['fileValidation']]); 54 | return; 55 | } 56 | } 57 | 58 | http_response_code(201); // File uploaded 59 | echo json_encode($response); 60 | } catch (Exception $e) { 61 | // Rollback the transaction on any exception 62 | $conn->rollback(); 63 | http_response_code(500); // Internal Server Error 64 | echo json_encode(['status' => 'error', 'message' => 'Internal Server Error: ' . $e->getMessage()]); 65 | } finally { 66 | // Enable autocommit after the try-catch block 67 | $conn->autocommit(true); 68 | } 69 | } else { 70 | // Return an error if the 'validation' parameter is missing 71 | http_response_code(400); // Bad Request 72 | echo json_encode(['status' => 'error', 'message' => 'Missing required parameter: fileValidation']); 73 | } 74 | } else { 75 | // Return an error if the 'data' parameter is missing 76 | http_response_code(400); // Bad Request 77 | echo json_encode(['status' => 'error', 'message' => 'Missing required parameter: fileDestination']); 78 | } 79 | } else { 80 | // Return an error if the request method is not POST 81 | http_response_code(405); // Method Not Allowed 82 | echo json_encode(['status' => 'error', 'message' => 'Invalid request method']); 83 | } 84 | -------------------------------------------------------------------------------- /configuration/functions.php: -------------------------------------------------------------------------------- 1 | $rules) { 40 | $value = isset($data[$key]) ? $data[$key] : null; 41 | $ref_id = 0; 42 | $rules = explode('|', $rules); 43 | 44 | foreach ($conditions as $condition) { 45 | $cond_on = mysqli_real_escape_string($conn, $condition['on']); 46 | $cond_value = mysqli_real_escape_string($conn, $condition['value']); 47 | if ($cond_on === "id") { 48 | $ref_id = $cond_value; 49 | } 50 | } 51 | 52 | foreach ($rules as $rule) { 53 | if ($rule === 'required' && empty($value)) { 54 | return "Field '$key' is required."; 55 | } elseif ($rule === 'string' && !is_string($value)) { 56 | return "Field '$key' must be a string."; 57 | } elseif ($rule === 'name' && !preg_match('/^[a-zA-Z\s]+$/', $value)) { 58 | return "Field '$key' must contain only letters and spaces."; 59 | } elseif ($rule === 'email' && !filter_var($value, FILTER_VALIDATE_EMAIL)) { 60 | return "Invalid email format for field '$key'."; 61 | } elseif ($rule === 'numeric' && !is_numeric($value)) { 62 | return "Field '$key' must be numeric."; 63 | } elseif (strpos($rule, 'min-length:') === 0) { 64 | if (preg_match('/min-length:(\d+)/', $rule, $matches)) { 65 | $minLength = intval($matches[1]); 66 | if (strlen($value) < $minLength) { 67 | return "Field '$key' must be at least $minLength characters long."; 68 | } 69 | } 70 | } elseif (strpos($rule, 'max-length:') === 0) { 71 | if (preg_match('/max-length:(\d+)/', $rule, $matches)) { 72 | $maxLength = intval($matches[1]); 73 | if (strlen($value) > $maxLength) { 74 | return "Field '$key' must be at most $maxLength characters long."; 75 | } 76 | } 77 | } elseif (strpos($rule, 'length:') === 0) { 78 | if (preg_match('/length:(\d+)/', $rule, $matches)) { 79 | $exactLength = intval($matches[1]); 80 | if (strlen($value) !== $exactLength) { 81 | return "Field '$key' must be exactly $exactLength characters long."; 82 | } 83 | } 84 | } elseif ($rule === 'unique') { 85 | $stmt = $conn->prepare("SELECT $key FROM $table WHERE $key = ? AND id != ?"); 86 | $stmt->bind_param("si", $value, $ref_id); 87 | $stmt->execute(); 88 | $result = $stmt->get_result(); 89 | 90 | if ($result && $result->num_rows > 0) { 91 | return "Field '$key' must be unique."; 92 | } 93 | } 94 | } 95 | } 96 | return null; 97 | } 98 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP CRUD Dynamic API 2 | 3 | The vision of this project is to empower developers to perform basic CRUD operations effortlessly without the need to write custom PHP code. The scripts are designed to be dynamic, allowing users to interact with the API simply by understanding the provided documentation and making HTTP requests. 4 | 5 | ## Table of Contents 6 | 7 | - [Introduction](#introduction) 8 | - [Connection Configuration](#connection-configuration) 9 | - [Create Data (`create.php`)](#create-data) 10 | - [Read Data (`read.php`)](#read-data) 11 | - [Update Data (`update.php`)](#update-data) 12 | - [Delete Data (`delete.php`)](#delete-data) 13 | - [File Upload (`file-upload.php`)](#file-upload) 14 | - [Customization and Security](#customization-security) 15 | - [Credits, Message from Creator](#credits) 16 | 17 | --- 18 | 19 | ## 1. Introduction 20 | 21 | This documentation provides an overview of a set of PHP scripts designed for basic CRUD operations (Create, Read, Update, Delete) and file uploads. The scripts are intended to be used as an API for managing data in a relational database. 22 | 23 | This project provides a set of PHP scripts designed to serve as a simple API for performing CRUD (Create, Read, Update, Delete) operations on a relational database. Additionally, it includes a script for handling file uploads. The scripts are intended to offer a flexible and extensible solution for managing data interactions with a backend server. 24 | 25 | --- 26 | 27 | ## 2. Connection Configuration 28 | 29 | Before using the scripts, ensure that the database connection is properly configured. The connection details can be found in the `configuration/connection.php` file. Modify the file to set your database host, username, password, and database name. 30 | 31 | Example `configuration/connection.php`: 32 | 33 | ```php 34 | define('DB_SERVER', 'YOUR_HOSTNAME'); 35 | define('DB_USERNAME', 'YOUR_USERNAME'); 36 | define('DB_PASSWORD', 'YOUR_PASSWORD'); 37 | define('DB_NAME', 'YOUR_DATABASE'); 38 | ``` 39 | 40 | --- 41 | 42 | ## 3. Create Data (create.php) 43 | 44 | Description: 45 | This script handles the creation of new records in the database based on the provided JSON data. 46 | 47 | #### Parameters: 48 | 49 | - `table` (required): The name of the database table to insert data into. 50 | - `validation` (optional): Validation rules for the data. 51 | - `data` (required): An array of records to be inserted. 52 | 53 | #### Data Validation Rules: 54 | 55 | The `validation` is used to validate the data based on the provided rules. The following validation rules are available: 56 | 57 | - `required`: The field must not be empty. 58 | - `string`: The field must be a valid string. 59 | - `name`: The field must be a valid name and without any integer or special characters. 60 | - `email`: The field must be a valid email format. 61 | - `numeric`: The field must be numeric. 62 | - `min-length:X`: The field must be at least X characters long. 63 | - `max-length:X`: The field must be at most X characters long. 64 | - `length:X`: The field must be exactly X characters long. 65 | - `unique`: The field value must be unique within the specified table | It'll check the `id` while updating the record, if it the same then simply it'll update the column. 66 | 67 | #### Example `body` in API request 68 | 69 | ```json 70 | { 71 | "table": "users", 72 | "validation": [ 73 | { 74 | "name": "required|string", 75 | "email": "required|email|unique", 76 | "phone": "required|numeric|unique|length:10", 77 | "password": "required|min-length:6", 78 | "age": "optional|numeric" 79 | } 80 | ], 81 | "data": [ 82 | { 83 | "name": "Imdadullah", 84 | "email": "imdad@imdos.com", 85 | "phone": "9992229990", 86 | "password": "VerySecurePassword", 87 | "age": 22 88 | } 89 | ] 90 | } 91 | ``` 92 | 93 | --- 94 | 95 | ## 4. Read Data (read.php) 96 | 97 | Description: 98 | This script retrieves data from the database based on the specified parameters. 99 | 100 | #### Parameters: 101 | 102 | - `table` (required): The name of the database table to query. 103 | - `select` (required): An array of columns to select. Default is all columns (\*). 104 | - `join` (optional): An array of join clauses for performing joins. 105 | - `conditions` (optional): An array of conditions with object with `on`, `type` and `value` for filtering data. 106 | - `rawConditions` (optional): An array of raw conditions for filtering data, make you sure pass either `conditions` or `rawConditions`. 107 | - `order` (optional): An object with `on` and `type` for ordering data. 108 | - `limit` (optional): Limit the number of records returned. 109 | 110 | #### Example `body` in API request 111 | 112 | ```json 113 | { 114 | "table": "users", 115 | "select": ["id", "name", "email", "age"], 116 | "order": { "on": "id", "type": "DESC" }, 117 | "conditions": [ 118 | { 119 | "on": "age", 120 | "type": ">=", 121 | "value": "18" 122 | }, 123 | { 124 | "on": "status", 125 | "type": "=", 126 | "value": "active" 127 | }, 128 | { 129 | "on": "email", 130 | "type": "LIKE", 131 | "value": "@gmail.com%" 132 | } 133 | ], 134 | "limit": 10 135 | } 136 | ``` 137 | 138 | #### Example `body` with `rawConditions` in API request 139 | 140 | ```json 141 | { 142 | "table": "users", 143 | "select": ["id", "name", "email", "age"], 144 | "order": { "on": "id", "type": "DESC" }, 145 | "rawConditions": [ 146 | "WHERE age >= '18' OR type = 'customer' AND status = 'active'" 147 | ] 148 | } 149 | ``` 150 | 151 | #### Example `body` with `JOIN` Parameter 152 | 153 | Note: You'll have to mention each table name along with the column name to use `JOIN` 154 | 155 | ```json 156 | { 157 | "table": "users", 158 | "select": [ 159 | "users.name", 160 | "users.email", 161 | "items.title", 162 | "items.price", 163 | "purchases.amount", 164 | "purchases.created_at AS purchased_date" 165 | ], 166 | "conditions": [ 167 | { 168 | "on": "purchases.item_id", 169 | "type": "=", 170 | "value": "102" 171 | } 172 | ], 173 | "join": [ 174 | { 175 | "table": "purchases", 176 | "on": ["purchases.user_id", "users.id"], 177 | "type": "LEFT" 178 | }, 179 | { 180 | "table": "items", 181 | "on": ["items.id", "purchases.item_id"], 182 | "type": "LEFT" 183 | } 184 | ] 185 | } 186 | ``` 187 | 188 | --- 189 | 190 | ## 5. Update Data (update.php) 191 | 192 | Description: 193 | This script updates existing records in the database based on the specified parameters. 194 | 195 | #### Parameters: 196 | 197 | - `table` (required): The name of the database table to query. 198 | - `data` (required): An array of fields and values to be updated. 199 | - `conditions` (required): An array of conditions for identifying records to update. 200 | - `validation` (optional): Validation rules for the data. 201 | 202 | #### Example `body` in API request 203 | 204 | ```json 205 | { 206 | "table": "users", 207 | "data": [ 208 | { 209 | "name": "Imdadullah Babu", 210 | "age": 22 211 | } 212 | ], 213 | "validation": [ 214 | { 215 | "name": "required|string", 216 | "age": "optional|numeric" 217 | } 218 | ], 219 | "conditions": [ 220 | { 221 | "on": "id", 222 | "type": "=", 223 | "value": "1" 224 | } 225 | ] 226 | } 227 | ``` 228 | 229 | --- 230 | 231 | ## 6. Delete Data (delete.php) 232 | 233 | Description: 234 | This script deletes records from the database based on the specified parameters. 235 | 236 | #### Parameters: 237 | 238 | - `table` (required): The name of the database table to delete from. 239 | - `conditions` (required): An array of conditions for identifying records to delete. 240 | 241 | #### Example `body` in API request 242 | 243 | ```json 244 | { 245 | "table": "users", 246 | "conditions": [ 247 | { 248 | "on": "id", 249 | "type": "=", 250 | "value": "1" 251 | } 252 | ] 253 | } 254 | ``` 255 | 256 | --- 257 | 258 | ## 7. File Upload (file-upload.php) 259 | 260 | Description: 261 | This script handles the uploading of files to a specified destination. 262 | 263 | #### Parameters: 264 | 265 | - `fileDestination` (required): The directory where the files will be stored. 266 | - `fileValidation` (required): A comma-separated list of allowed file extensions. 267 | 268 | Note: You can upload multiple files at once, and this will not insert into your database table, You'll get the url as response and you can save it to the database. 269 | 270 | #### Example API request 271 | 272 | ```javascript 273 | 298 | ``` 299 | 300 | #### API Response 301 | 302 | ``` 303 | { 304 | "file": "uploads/files/2024011984368.jpg", 305 | "image": "uploads/files/2024011960039.jpg" 306 | } 307 | ``` 308 | 309 | Note: Customize and extend the scripts based on your project's requirements. Ensure proper validation and security measures are implemented in a production environment. 310 | 311 | --- 312 | 313 | ## 8. Customization and Security 314 | 315 | For additional security measures or custom logic, developers can extend the functionality by adding their own logic to the `configuration/custom-functions.php` file. This provides a space to incorporate token validation, custom authentication, or any other security measures according to project requirements. 316 | 317 | ### Instructions for Customization: 318 | 319 | - Open the configuration/custom-functions.php file. 320 | - Add your own custom logic, functions, or security measures. 321 | - Use the added functions within the codebase as needed. 322 | 323 | ### Notes: 324 | 325 | - Developers are encouraged to review and customize the provided scripts to meet the specific requirements of their projects. 326 | - Custom functions added to custom-functions.php can be seamlessly integrated into the existing codebase. 327 | - Developers have the freedom to enhance security and implement project-specific logic according to their needs. 328 | 329 | --- 330 | 331 | ## 9. Credits: 332 | 333 | This project was developed by [Imdadullah Babu](https://imdos.in), The scripts aim to provide a foundation for PHP developers to integrate basic database operations and file uploads into their projects without writing repeatable codes. 334 | 335 | #### Acknowledgments 336 | 337 | This project is open-source, and we welcome contributions from developers worldwide. Whether you're interested in adding new features, improving documentation, fixing bugs, or suggesting enhancements, your contributions are valuable. 338 | 339 | #### Message from Creator 340 | 341 | Together, we can make this project even more versatile and beneficial for the developer community. Your contributions, big or small, are highly appreciated. 342 | 343 | Thank you for being a part of our open-source journey! 344 | --------------------------------------------------------------------------------