Skip to content

Commit

Permalink
update composer
Browse files Browse the repository at this point in the history
  • Loading branch information
papac committed Jan 28, 2025
1 parent e32dfc3 commit 4fee1db
Show file tree
Hide file tree
Showing 3 changed files with 168 additions and 13 deletions.
82 changes: 70 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
version: '3.8'

volumes:
mysql_data:
driver: local
postgres_data:
driver: local
redis_data:
driver: local
ftp_storage:
driver: local

networks:
bowphp_network:
driver: bridge

services:
mysql:
container_name: bowphp_mysql
image: mysql/mysql-server
image: mysql/mysql-server:8.0
restart: unless-stopped
ports:
- "3306:3306"
environment:
Expand All @@ -14,51 +28,95 @@ services:
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
postgres:
container_name: bowphp_postgres
image: postgis/postgis
image: postgis/postgis:15-3.3
restart: unless-stopped
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- bowphp_network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U bowphp"]
interval: 10s
timeout: 5s
retries: 5
ftp:
container_name: bowphp_ftp
image: papacdev/vsftpd
restart: unless-stopped
ports:
- "21:21"
- "20:20"
- "12020:12020"
- "12021:12021"
- "12022:12022"
- "12023:12023"
- "12024:12024"
- "12025:12025"
- "12020-12025:12020-12025"
environment:
USER: bob
PASS: "12345"
volumes:
- "ftp_storage:/ftp/$USER"
networks:
- bowphp_network
mail:
container_name: bowphp_mail
image: maildev/maildev
restart: unless-stopped
ports:
- "1025:25"
- "1080:80"
networks:
- bowphp_network
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "25"]
interval: 10s
timeout: 5s
retries: 5
beanstalkd:
container_name: bowphp_beanstalkd
image: schickling/beanstalkd
restart: unless-stopped
ports:
- "11300:11300"
networks:
- bowphp_network
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "11300"]
interval: 10s
timeout: 5s
retries: 5
redis:
container_name: bowphp_redis
image: redis
image: redis:7-alpine
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis_data:/data
networks:
- bowphp_network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
command: redis-server --appendonly yes
memcached:
container_name: bowphp_memcached
image: memcached
image: memcached:1.6-alpine
restart: unless-stopped
ports:
- "11211:11211"
command:
- --conn-limit=1024
- --memory-limit=64
- --threads=4
ports:
- "11211:11211"
networks:
- bowphp_network
healthcheck:
test: ["CMD", "nc", "-z", "localhost", "11211"]
interval: 10s
timeout: 5s
retries: 5
58 changes: 57 additions & 1 deletion src/Database/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,16 @@ Database::configure([
"database" => ":memory:",
"prefix" => "table_prefix"
],
// TODO: Build the pgsql support for v5.0
'pgsql' => [
'driver' => 'pgsql',
'hostname' => app_env('DB_HOSTNAME', 'localhost'),
'username' => app_env('DB_USERNAME', 'test'),
'password' => app_env('DB_PASSWORD', 'test'),
'database' => app_env('DB_DBNAME', 'test'),
'charset' => app_env('DB_CHARSET', 'utf8'),
'prefix' => app_env('DB_PREFIX', ''),
'port' => app_env('DB_PORT', 3306)
],
]
]);
```
Expand All @@ -53,4 +62,51 @@ use App\Models\User as UserModel;
$users = UserModel::all();
```

## Diagramme de séquence

```mermaid
sequenceDiagram
participant App as Application
participant DB as Database
participant Adapter as DatabaseAdapter
participant Query as QueryBuilder
participant PDO as PDO Connection
participant DB_Server as Database Server
Note over App,DB_Server: Configuration and Connection
App->>DB: Database::configure(config)
DB->>DB: getInstance()
alt MySQL Connection
DB->>Adapter: new MysqlAdapter(config)
else PostgreSQL Connection
DB->>Adapter: new PostgreSQLAdapter(config)
else SQLite Connection
DB->>Adapter: new SqliteAdapter(config)
end
Adapter->>PDO: new PDO(dsn, username, password)
PDO-->>DB_Server: Establishes connection
Note over App,DB_Server: Queries with Query Builder
App->>DB: table('users')
DB->>Query: new QueryBuilder('users', connection)
Query->>Adapter: getInstance()
alt Select Query
App->>Query: where('id', 1)->get()
Query->>Query: toSql()
Query->>PDO: prepare(sql)
PDO->>DB_Server: Execute Query
DB_Server-->>App: Results
else Insert Query
App->>Query: insert(['name' => 'John'])
Query->>PDO: prepare(sql)
PDO->>DB_Server: Execute Query
DB_Server-->>App: Affected Rows
end
```

Is very enjoyful api
41 changes: 41 additions & 0 deletions src/Router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,45 @@ $app->get('/', function () {
});
```

## Diagramme de flux du routage

```mermaid
sequenceDiagram
participant Client as Client HTTP
participant Router as Router
participant Route as Route
participant Middleware as Middleware
participant Controller as Controller/Callback
participant Response as Response
Note over Client,Response: Traitement d'une requête HTTP
Client->>Router: Requête HTTP (GET /users)
Router->>Router: match(uri)
alt Route trouvée
Router->>Route: match(uri)
Route->>Route: checkRequestUri()
alt Avec Middleware
Route->>Middleware: process(request)
Middleware-->>Route: next(request)
end
Route->>Route: getParameters()
Route->>Controller: call(parameters)
Controller-->>Response: return response
Response-->>Client: Envoie réponse HTTP
else Route non trouvée
Router-->>Response: 404 Not Found
Response-->>Client: Erreur 404
end
Note over Client,Response: Exemple de définition de route
Note right of Router: $app->get('/users/:id', function($id) { ... })
Note right of Router: $app->post('/users', [UserController::class, 'store'])
```

Is very enjoyful api

0 comments on commit 4fee1db

Please sign in to comment.