Skip to content

Commit a5c69a3

Browse files
committed
docs: remove obsolete config.example.php and update all documentation
Removed: - examples/config.example.php (obsolete multi-dialect format) - Used old array format with keys: ['mysql' => [...], 'pgsql' => [...]] - No longer compatible with current architecture - All actual configs already in repo Updated Documentation: - README.md: Removed config creation instructions (configs already exist) - examples/README.md: Updated status table - all configs included - scripts/test-examples.sh: Updated tip message (no config.example.php reference) Current Architecture (CORRECT): ✅ examples/config.sqlite.php - ready to use (:memory:) ✅ examples/config.mysql.php - update credentials and run ✅ examples/config.pgsql.php - update credentials and run .gitignore Update: - Removed examples/config.php from ignore (not used anymore) - Added comment: config.*.php files tracked in repo with default credentials - Users just update credentials, no copying needed User Experience: Before: "Copy config.example.php to config.php, then edit" After: "Edit config.mysql.php with your credentials" Much simpler and less confusing! Testing: ✅ All 21 examples still pass on all 3 dialects (63/63)
1 parent b82227b commit a5c69a3

5 files changed

Lines changed: 15 additions & 95 deletions

File tree

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ coverage-*.xml
1010
coverage/
1111
.coverage
1212

13-
# Examples
14-
examples/config.php
13+
# Examples - temporary files only
14+
# Note: config.*.php files are tracked in repo with default credentials
1515
examples/**/*.db
1616
examples/**/*.sqlite
1717
examples/**/*.sql

README.md

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -124,40 +124,13 @@ Each example is self-contained with setup instructions. See [`examples/README.md
124124
```bash
125125
cd examples
126126

127-
# SQLite is already configured (examples/config.sqlite.php)
127+
# SQLite (ready to use, no setup required)
128128
php 01-basic/02-simple-crud.php
129129

130-
# For MySQL - create config.mysql.php based on config.example.php
131-
cat > config.mysql.php << 'EOF'
132-
<?php
133-
return [
134-
'driver' => 'mysql',
135-
'host' => 'localhost',
136-
'port' => 3306,
137-
'username' => 'your_user',
138-
'password' => 'your_pass',
139-
'dbname' => 'your_db',
140-
'charset' => 'utf8mb4'
141-
];
142-
EOF
143-
144-
# Run with MySQL
130+
# MySQL (update config.mysql.php with your credentials)
145131
PDODB_DRIVER=mysql php 01-basic/02-simple-crud.php
146132

147-
# For PostgreSQL - create config.pgsql.php
148-
cat > config.pgsql.php << 'EOF'
149-
<?php
150-
return [
151-
'driver' => 'pgsql',
152-
'host' => 'localhost',
153-
'port' => 5432,
154-
'username' => 'your_user',
155-
'password' => 'your_pass',
156-
'dbname' => 'your_db'
157-
];
158-
EOF
159-
160-
# Run with PostgreSQL
133+
# PostgreSQL (update config.pgsql.php with your credentials)
161134
PDODB_DRIVER=pgsql php 01-basic/02-simple-crud.php
162135

163136
# Test all examples on all available databases

examples/README.md

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,19 @@ php 01-basic/02-simple-crud.php
1212

1313
### Option 2: MySQL
1414
```bash
15-
# Create MySQL configuration
16-
cat > config.mysql.php << 'EOF'
17-
<?php
18-
return [
19-
'driver' => 'mysql',
20-
'host' => 'localhost',
21-
'port' => 3306,
22-
'username' => 'your_user',
23-
'password' => 'your_pass',
24-
'dbname' => 'your_db',
25-
'charset' => 'utf8mb4'
26-
];
27-
EOF
15+
# Edit config.mysql.php with your credentials
16+
# File already exists in examples/ directory
17+
nano config.mysql.php
2818

2919
# Run with MySQL
3020
PDODB_DRIVER=mysql php 01-basic/02-simple-crud.php
3121
```
3222

3323
### Option 3: PostgreSQL
3424
```bash
35-
# Create PostgreSQL configuration
36-
cat > config.pgsql.php << 'EOF'
37-
<?php
38-
return [
39-
'driver' => 'pgsql',
40-
'host' => 'localhost',
41-
'port' => 5432,
42-
'username' => 'your_user',
43-
'password' => 'your_pass',
44-
'dbname' => 'your_db'
45-
];
46-
EOF
25+
# Edit config.pgsql.php with your credentials
26+
# File already exists in examples/ directory
27+
nano config.pgsql.php
4728

4829
# Run with PostgreSQL
4930
PDODB_DRIVER=pgsql php 01-basic/02-simple-crud.php
@@ -64,9 +45,9 @@ PDOdb examples use **separate config files per database**:
6445

6546
| File | Database | Status |
6647
|------|----------|--------|
67-
| `config.sqlite.php` | SQLite | ✅ Included in repo |
68-
| `config.mysql.php` | MySQL | Create from `config.example.php` |
69-
| `config.pgsql.php` | PostgreSQL | Create from `config.example.php` |
48+
| `config.sqlite.php` | SQLite | ✅ Included, ready to use (`:memory:`) |
49+
| `config.mysql.php` | MySQL | ✅ Included, update credentials |
50+
| `config.pgsql.php` | PostgreSQL | ✅ Included, update credentials |
7051

7152
**Environment variable `PDODB_DRIVER`** controls which config to use:
7253
- `sqlite` (default) - loads `config.sqlite.php`

examples/config.example.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

scripts/test-examples.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ else
213213
echo "$db"
214214
done
215215
echo ""
216-
echo " See examples/config.example.php for reference"
216+
echo " Config files included - just update credentials in examples/config.*.php"
217217
fi
218218

219219
exit 0

0 commit comments

Comments
 (0)