The Custom PHP connector is a small package that lets a PHP site without WordPress receive content prepared in Autodigy once you have approved it. This article covers installing the package.
Before you start
- A developer should do the installation. When you choose Custom PHP on the add-site screen, the notice "This option requires a developer." appears; the Send setup instructions to your developer button copies the address and token details to the clipboard.
- The server needs PHP 8.2 or later, the
pdo and mbstring extensions, and Composer. The database is MySQL or SQLite.
- Your site must open over HTTPS. Adding a site needs the account owner, administrator or team manager role.
Steps
- On the Sites page, select Add site. Choose Custom PHP as the Publishing platform and download
autodigy-custom-php-connector.zip with Download connector package. The package contains composer.json, README.md, src/Connector.php, public/index.php and two database schemas (migrations/mysql.sql, migrations/sqlite.sql).
- Copy the package into your site project and run
composer install --no-dev. Route only /api/* paths to public/index.php in your web server. The package handles only /api/ping, /api/migration-status, /api/capabilities and /api/posts.
- Apply
migrations/mysql.sql or migrations/sqlite.sql to your database. This does not drop existing tables.
- Provide these values through your server's secret (env) mechanism:
CONNECTOR_DSN, CONNECTOR_DB_USER, CONNECTOR_DB_PASSWORD, CONNECTOR_TOKEN and an HTTPS SITE_BASE_URL. Do not commit the token to a repository. Choose a strong value that cannot be guessed.
- Check it on your side. With the Bearer token,
GET /api/migration-status should return ready, GET /api/ping should return ok:true, and OPTIONS /api/posts should list the POST method. Without the token, the same endpoints should return 401.
- Go back to the add-site form in Autodigy. Fill in the site name and Site address, and enter the
CONNECTOR_TOKEN value in API token. The token must be identical on both sides.
- In 3. Test Connection, select Test connection. When Connection working appears, save with Save Site and Continue. On the saved site's page, repeat the test with Test connection; that test records its result on the site.
The connection test reads /api/ping, /api/migration-status and /api/posts (OPTIONS) in that order and does not create content. After it passes, try the publishing flow with a test post before you approve real content.
Good to know
- A publish request carries an
Idempotency-Key. If the same key and the same content arrive again, the connector does not create a new record; it returns the earlier record ID and address. The same key with different content returns 409.
- The connector stores content HTML as it is. Your site's display layer must apply its own HTML safety policy.
- The package covers single-language publishing. Multi-language publishing targets need an extra schema and settings, which are outside this article.
Common problems
- "Authentication failed. Update the connection credentials." The API token in Autodigy does not match
CONNECTOR_TOKEN on the server.
- "Check the connector publishing permission." The connector rejected the request (403). Check the permission and token settings.
- "The connector database migration is incomplete." The schema file was not applied, or
/api/migration-status does not return ready.
- "The connector publishing endpoint is unavailable." The
OPTIONS /api/posts response does not include POST; check your routing.
- "The connector ping endpoint did not respond successfully." The
/api/ping request does not reach the connector, or the connector returns an error. Check the web server routing and the database connection (CONNECTOR_DSN, credentials). When the database is unreachable, the connector returns 503.
- "The site DNS address could not be resolved" or "A secure TLS connection could not be established." Check the domain name and the HTTPS certificate.
For every message, see Connection test and troubleshooting.
Related articles