HUB
Sign inSign up

softfour/crud-api

By softfour

•Updated about 10 hours ago

PHP-CRUD-API with Apache proxy support and a short /api/ route to database records.

Image
API management
0

618

softfour/crud-api repository overview

⁠Softfour CRUD API

REST API container derived from mevdschee/php-crud-api⁠, with small Apache customizations for Softfour deployments.

⁠Softfour-specific changes

  • Enables Apache proxy and proxy_http modules.
  • Adds ProxyPass /api/ http://localhost/api.php/records/, so /api/posts maps to /api.php/records/posts.
  • Adds php_value error_reporting 1 to the application's .htaccess.

Database drivers, query syntax, controllers and middleware come from upstream. This image does not create a database or provision a schema.

⁠Tags and platforms

TagBasePublished platform
latestmevdschee/php-crud-api:latestlinux/amd64

Checked on 2026-11-08. Both the Softfour tag and the upstream base tag can move; pin a digest for repeatable deployments. No native ARM64 variant is currently advertised.

⁠Quick start with Docker Compose

This example connects to an existing MySQL-compatible database. Create a local .env file containing DB_HOST, DB_NAME, DB_USER and DB_PASSWORD. Use a database account limited to the operations and tables your API needs. Set DB_TABLES to a comma-separated list of tables to expose, for example posts.

services:
  crud-api:
    image: softfour/crud-api:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:8080:80"
    environment:
      PHP_CRUD_API_DRIVER: "mysql"
      PHP_CRUD_API_ADDRESS: "${DB_HOST:?Set DB_HOST}"
      PHP_CRUD_API_PORT: "${DB_PORT:-3306}"
      PHP_CRUD_API_DATABASE: "${DB_NAME:?Set DB_NAME}"
      PHP_CRUD_API_USERNAME: "${DB_USER:?Set DB_USER}"
      PHP_CRUD_API_PASSWORD: "${DB_PASSWORD:?Set DB_PASSWORD}"
      PHP_CRUD_API_TABLES: "${DB_TABLES:?Set DB_TABLES to the tables to expose}"
docker compose config --quiet
docker compose up -d
docker compose logs --tail=100 crud-api
curl --fail-with-body http://127.0.0.1:8080/api/posts

The request assumes an existing permitted posts table. Replace it with your table name. DB_HOST must resolve and be reachable from the container; localhost inside the container refers to that container, not the Docker host. The example publishes HTTP only on the host's loopback interface and does not configure API authentication.

⁠Configuration

VariableDefault or requirementPurpose
PHP_CRUD_API_DRIVERUpstream default mysqlDatabase driver; upstream also supports pgsql, sqlsrv and sqlite
PHP_CRUD_API_ADDRESSUpstream default localhostDatabase hostname, or database file for SQLite
PHP_CRUD_API_PORTDriver defaultDatabase TCP port
PHP_CRUD_API_DATABASERequired for the exampleDatabase name
PHP_CRUD_API_USERNAMERequired for the exampleDatabase user
PHP_CRUD_API_PASSWORDRequired for the exampleDatabase password
PHP_CRUD_API_TABLESUpstream exposes all tables unless restrictedComma-separated table allowlist
PHP_CRUD_API_MIDDLEWARESUpstream default corsMiddleware selection, including authentication and authorization options

See the upstream configuration reference⁠ for the complete option set. Features depend on the upstream version bundled into the selected image.

⁠Paths, storage and security

Apache listens on container port 80. The short /api/ route maps only to the records controller; use upstream paths for other enabled controllers. The proxy target uses HTTP on localhost inside the container.

The example uses an external database, so database persistence and backup belong to that database deployment. A SQLite deployment needs a separate persistent, writable mount and matching database-file configuration.

Configure API authentication, authorization, table restrictions and TLS termination before granting remote access. Database credentials alone are not API-client authentication. Keep .env and other secret files out of version control; container environment variables can be read by Docker administrators. Avoid printing expanded Compose configuration when handling real secrets.

⁠Operations and troubleshooting

docker compose ps
docker compose logs --tail=100 crud-api

For connection failures, check database DNS, port, user privileges and network access. For missing tables, check the schema, allowlist and request path. For unexpected API behavior, compare against the documentation for the bundled upstream version. Redact credentials and database contents before sharing logs.

⁠Upgrade and rollback

Back up the database and record the current image digest before upgrading:

docker compose pull crud-api
docker compose up -d crud-api

Verify representative read and write operations against a test database before promoting a changed upstream version. To roll back, use the previous softfour/crud-api@sha256:... digest and matching configuration; database changes may require a matching database restore.

⁠Maintenance and support

Maintained by Softfour⁠. For support, use your existing Softfour support channel and include the image tag, digest, platform and relevant logs with credentials removed.

The repository README is the source for this Docker Hub overview. Documentation updates do not change image contents. No versioned image changelog is currently published; record the digest before upgrading.

⁠License and upstream

PHP-CRUD-API⁠ is published under the upstream MIT license; Apache, PHP and other bundled components have their own licenses. Third-party components retain their respective licenses. Contact Softfour for licensing information about image-specific files.

Tag summary

Content type

Image

Digest

sha256:8d5a2504d…

Size

174.2 MB

Last updated

about 10 hours ago

docker pull softfour/crud-api