npm.io
0.1.2 • Published 3h ago

@jtl-software/cloud-app-template-backend-php

Licence
Version
0.1.2
Deps
0
Size
51 kB
Vulns
0
Weekly
0

PHP Backend Template

Slim 4 + JWT verification (Ed25519, via libsodium)

Requirements

PHP 8.5+ with the sodium, curl, and json extensions (all bundled with modern PHP), plus Composer on your PATH.

No local PHP? Use the container workflow instead.

Configuration

Copy .env.example to .env and add your Client ID and Secret.

Scripts

  • npm run dev — installs Composer deps if needed, then serves on port 3005 via PHP's built-in server
  • npm run build — installs production Composer deps (--no-dev)

You can also run the server directly:

composer install
php -S localhost:3005 -t public public/index.php

Alternative: container workflow

If you don't have a local PHP setup, run everything inside a container via the Makefile. No local PHP or Composer required.

make help            # list all targets
make install         # composer install --no-dev
make install-dev     # composer install (with dev deps)
make update          # composer update
make shell           # open a shell inside the composer container
make clean           # remove vendor/

Set CONTAINER=docker (or podman) to enable containerized mode:

CONTAINER=docker make install-dev
CONTAINER=docker make test

build and run targets require a container runtime:

CONTAINER=docker make build   # build the runtime image
CONTAINER=docker make run     # build + start the server on $PORT (default 3005)

Endpoints

  • GET /health — reports whether CLIENT_ID/CLIENT_SECRET are configured
  • POST /connect-tenant — verifies a session token during the setup flow
  • POST /graphql — proxies a GraphQL request to the JTL ERP API (X-Session-Token header)
  • ALL /erp-info/{tenantId}/{endpoint} — proxies a REST request to the JTL ERP API