Skip to content

Commit f146f3a

Browse files
committed
up
1 parent 66681db commit f146f3a

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,37 @@ OpenAPI (Swagger) docs, and zero code generation.
2929
📖 **[See detailed enhancement documentation →](ENHANCEMENTS.md)**
3030
📖 **[Rate Limiting Documentation →](docs/RATE_LIMITING.md)**
3131
📖 **[Request Logging Documentation →](docs/REQUEST_LOGGING.md)**
32+
📖 **[Quick Start (5 minutes) →](docs/QUICK_START.md)**
3233

3334
---
3435

3536
## 📦 Installation
3637

38+
### Option 1: Install as Library (Recommended)
39+
40+
Install via Composer (Packagist):
41+
42+
```bash
43+
composer require bitshost/php-crud-api-generator
44+
```
45+
46+
Then copy 3 files to your project root and modify 2 lines:
47+
48+
```bash
49+
# Copy files
50+
copy vendor/bitshost/php-crud-api-generator/public/index.php index.php
51+
copy vendor/bitshost/php-crud-api-generator/dashboard.html dashboard.html
52+
copy vendor/bitshost/php-crud-api-generator/health.php health.php
53+
54+
# Edit index.php - change 2 config paths to point to vendor (see QUICK_START.md)
55+
```
56+
57+
**See [Quick Start Guide →](docs/QUICK_START.md) for detailed 5-minute setup.**
58+
59+
### Option 2: Standalone Project
60+
61+
Clone or download the full project:
62+
3763
```bash
3864
composer create-project bitshost/php-crud-api-generator
3965
```
@@ -42,13 +68,28 @@ composer create-project bitshost/php-crud-api-generator
4268

4369
## ⚙️ Configuration
4470

71+
### If installed as library (via composer require):
72+
73+
Edit config files in vendor directory:
74+
75+
```bash
76+
notepad vendor/bitshost/php-crud-api-generator/config/db.php
77+
notepad vendor/bitshost/php-crud-api-generator/config/api.php
78+
```
79+
80+
### If standalone project (via composer create-project):
81+
4582
Copy and edit config files:
4683

4784
```bash
4885
cp config/db.example.php config/db.php
4986
cp config/api.example.php config/api.php
5087
```
5188

89+
---
90+
91+
**Config file structure:**
92+
5293
Edit `config/db.php`:
5394

5495
```php

docs/QUICK_START.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Quick Start - bitshost/php-crud-api-generator
2+
3+
**Get started in 5 minutes!**
4+
5+
---
6+
7+
## Step 1: Install
8+
9+
```bash
10+
composer require bitshost/php-crud-api-generator
11+
```
12+
13+
---
14+
15+
## Step 2: Copy 3 files to project root
16+
17+
```bash
18+
copy vendor\bitshost\php-crud-api-generator\public\index.php index.php
19+
copy vendor\bitshost\php-crud-api-generator\dashboard.html dashboard.html
20+
copy vendor\bitshost\php-crud-api-generator\health.php health.php
21+
```
22+
23+
---
24+
25+
## Step 3: Edit index.php (2 lines)
26+
27+
Change config paths to point to vendor:
28+
29+
```php
30+
// Change this:
31+
$dbConfig = require __DIR__ . '/config/db.php';
32+
$apiConfig = require __DIR__ . '/config/api.php';
33+
34+
// To this:
35+
$dbConfig = require __DIR__ . '/vendor/bitshost/php-crud-api-generator/config/db.php';
36+
$apiConfig = require __DIR__ . '/vendor/bitshost/php-crud-api-generator/config/api.php';
37+
```
38+
39+
---
40+
41+
## Step 4: Configure (in vendor directory)
42+
43+
```bash
44+
notepad vendor\bitshost\php-crud-api-generator\config\db.php
45+
notepad vendor\bitshost\php-crud-api-generator\config\api.php
46+
```
47+
48+
**db.php:**
49+
```php
50+
return [
51+
'host' => 'localhost',
52+
'dbname' => 'your_database',
53+
'user' => 'root',
54+
'pass' => '',
55+
'charset' => 'utf8mb4'
56+
];
57+
```
58+
59+
**api.php - Generate JWT secret:**
60+
```bash
61+
php -r "echo bin2hex(random_bytes(32));"
62+
```
63+
64+
Paste result into api.php:
65+
```php
66+
'jwt_secret' => 'YOUR_64_CHAR_SECRET_HERE',
67+
```
68+
69+
---
70+
71+
## Step 5: Run!
72+
73+
```bash
74+
php -S localhost:8000
75+
```
76+
77+
---
78+
79+
## Test
80+
81+
```bash
82+
# Login
83+
curl -X POST -d "username=admin&password=password123" http://localhost:8000/?action=login
84+
85+
# View dashboard
86+
http://localhost:8000/dashboard.html
87+
```
88+
89+
---
90+
91+
## Summary
92+
93+
**3 files copied:**
94+
- index.php (2 lines modified)
95+
- dashboard.html (0 modifications)
96+
- health.php (0 modifications)
97+
98+
**2 files edited:**
99+
- vendor/.../config/db.php
100+
- vendor/.../config/api.php
101+
102+
**Total code changes: 2 lines!** 🎉
103+
104+
That's it! Your API is ready. All configs stay in vendor directory - clean and simple!

0 commit comments

Comments
 (0)