FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

docs: add agent-readable documentation and repository metadata by const-cloudinary · Pull Request #428 · cloudinary/cloudinary_php · GitHub

docs: add agent-readable documentation and repository metadata - #428

Open
const-cloudinary wants to merge 2 commits into
masterfrom
docs/agent-readable-documentation
Open

docs: add agent-readable documentation and repository metadata#428
const-cloudinary wants to merge 2 commits into
masterfrom
docs/agent-readable-documentation

Conversation

const-cloudinary commented Aug 24, 2026
edited
Loading

Copy link
Copy Markdown
Member

Adds task-oriented documentation that ships inside the Composer package, so it always matches the installed version.

  • docs/ — index plus 13 task pages: imports, configuration, a complete runnable flow, result fields, failure modes.
  • examples/ — 12 runnable files, one per task page.
  • Restructured README, AGENTS.md, SECURITY.md.
  • .gitattributes controls what ships. Installed path: vendor/cloudinary/cloudinary_php/docs/. It also excludes tests/, tools/, samples/, apidocs/, .github/, and the lint/test configs — anything referencing vendor/cloudinary/cloudinary_php/tests/ would break on upgrade.
  • API-doc tooling moves from docs/ to apidocs/; tools/update_version.sh updated to match.

Corrections

Every snippet was executed against a live cloud, which caught real errors:

  • The API accessors are methods. The README documented $cloudinary->uploadApi->upload(...), which is a fatal error. It is $cloudinary->uploadApi()->upload(...).
  • ApiUtils is Cloudinary\Api\ApiUtils, though the file sits at src/Api/Utils/ApiUtils.php.
  • There is no uploadLarge() — upload() chunks automatically above chunk_size.
  • A partial config array replaces rather than merges, so new Cloudinary(['logging' => ...]) throws by discarding credentials.
  • ConfigurationException does not extend ApiError and is in a different namespace, so catch (ApiError) alone misses it.

Also documented: resource_type defaults to image and fails loudly on video; update() returns context nested under custom; redeclaring a metadata field throws BadRequest.

Integration test fix (ddf6548)

Three integration tests asserted the exact shape of API responses and broke when the API added fields. Pre-existing on master, which last ran CI in April 2026 — unrelated to the documentation work, but fixed here so CI can go green.

  • testListFacebookImages, testFacebookImagesWidthHeight asserted Facebook assets carry no width/height. They now do. Raw assets still legitimately have none, so the cases are split: raw asserts absence, Facebook asserts integers when present.
  • testCreateDateMetadataField asserted restrictions equals exactly ['readonly_ui' => true]; the API now also returns hidden_ui and excluded_from_search. Fixed in the shared assertion loop, so every metadata test checks that expected keys are present and correct rather than that they are the only keys.

Bring the repository up to the Cloudinary agent-readable documentation standard,
following the structure shipped in cloudinary_npm (PRs #742 and #744).

Documentation, shipped inside the Composer package so it is always version-matched
to the installed code:

- docs/ — 13 task pages with an index carrying the agent-rules banner. Every
  snippet was executed against a live cloud before being committed.
- examples/ — 12 runnable files, one per task page, all verified green.

Repository files:

- README.md restructured: quick start, common tasks, when to use this SDK,
  compatibility, and a read path for coding agents.
- AGENTS.md (six sections) plus CLAUDE.md; SECURITY.md with private vulnerability
  reporting; context7.json.

Packaging:

- .gitattributes decides what ships. docs/ and examples/ reach users at
  vendor/cloudinary/cloudinary_php/; tests/, tools/, samples/, apidocs/, and the
  lint/test configs no longer do.
- The Sami API-doc tooling moves from docs/ to apidocs/ so that docs/ can hold the
  Markdown task docs, which is the path agents look for. tools/update_version.sh
  is updated to match.

Corrections found by executing the documented calls rather than reading the source:

- The API accessors are methods. The previous README documented
  $cloudinary->uploadApi->upload(...), which is a fatal error; it is
  $cloudinary->uploadApi()->upload(...).
- ApiUtils is Cloudinary\Api\ApiUtils, although the file sits in src/Api/Utils/.
- There is no uploadLarge(); upload() chunks automatically above chunk_size.
- A partial configuration array replaces rather than merges, so passing only
  'logging' discards credentials from CLOUDINARY_URL.
const-cloudinary force-pushed the docs/agent-readable-documentation branch from c752ffa to 9bfbbdd Compare August 24, 2026 22:24
Three integration tests asserted the exact shape of API responses and broke when
the API added fields:

- testListFacebookImages and testFacebookImagesWidthHeight asserted that Facebook
  assets carry no width or height. They now do. Raw assets still legitimately have
  none, so the two cases are split: raw asserts absence, Facebook asserts the values
  are integers when present.
- testCreateDateMetadataField asserted that `restrictions` equals exactly
  ['readonly_ui' => true]. The API now also returns `hidden_ui` and
  `excluded_from_search`.

The metadata fix is in the shared assertion loop, so every metadata test now checks
that the expected keys are present and correct rather than that they are the only
keys. Added fields no longer read as regressions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL