Directory Structure
Below is an example structure of the responses
directory. You can freely customize it based on your use case.
mock_api_server/
├── index.php # Main script for the mock server
├── generate-schema.php # OpenAPI 3.0 Schema Generation Script
├── http_status.php # HTTP status code definitions
├── start_server.php # Local server startup script
├── .env # Configuration file (.env.sample provides a template)
├── vendor/ # Composer packages
├── composer.json # PHP package manager configuration
├── composer.lock # Composer lock file
├── responses/ # Directory for storing response data
│ ├── users/
│ │ ├── get/
│ │ │ ├── 1.json # First request response
│ │ │ ├── 2.json # Second request response
│ │ │ ├── default.json # Default response
│ │ │ └── delay.json # Delayed response
│ │ ├── delete/
│ │ │ └── default.json # DELETE response
│ │ └── post/
│ │ ├── 400.json # 400 error response
│ │ ├── failed.json # Failed POST response
│ │ └── success.json # Successful POST response
│ ├── errors/
│ │ ├── 404.json # 404 error response (JSON format)
│ │ └── 500.txt # 500 error response (text format)
│ └── others/
│ ├── products/
│ │ └── put/
│ │ └── default.json # PUT response
│ └── get/
│ ├── default.txt # CSV data as text
│ └── userlist.txt # XML data as text
├── hooks/ # Custom hook scripts
├── tests/ # Unit test cases
│ └── MockApiTest.php # Initial test cases
├── phpunit.xml # PHPUnit configuration file
├── version.json # Version information file
├── schema/ # OpenAPI Schema Output Directory
└── logs/ # Directory for log storage
├── auth.log # Authentication error logs
├── error.log # General error logs
├── request.log # Request logs
├── response.log # Response logs
└── validation-error.log # OpenAPI Schema Validation Error Logs