Download the PHP package eng-mmustafa/canopy without Composer
On this page you can find all versions of the php package eng-mmustafa/canopy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eng-mmustafa/canopy
More information about eng-mmustafa/canopy
Files in eng-mmustafa/canopy
Package canopy
Short Description Beautiful, hierarchical API documentation for Laravel. A branded, nested endpoint explorer powered by Scramble.
License MIT
Homepage https://github.com/Eng-MMustafa/canopy
Informations about the package canopy
πΏ Canopy
Beautiful, hierarchical API documentation for Laravel β powered by Scramble.
Scramble generates a great OpenAPI document automatically. Canopy adds what large APIs need: a nested, navigable, branded documentation explorer. Group your endpoints into a tree (Admin β Users β Sessionsβ¦), search them instantly, and ship docs that look like your product.
Canopy is a drop-in add-on. It depends on Scramble and does not modify or fork it β it builds on Scramble's public extension points, so you keep upgrading Scramble normally.
Why Canopy?
- Hierarchical groups β unlimited nesting, unlike flat tag lists.
- Zero core changes β pure add-on; your Scramble setup is untouched.
- Your brand β title, logo, accent color, light/dark theme.
- Dark / Light mode toggle β one-click switch with preference saved in
localStorage. - Fast search β filter the whole API tree as you type.
- Automatic grouping β by
#[Group]attribute, config rules, route prefix/name, or controller name. - Bearer token support β add
securitySchemesonce; TryIt shows an auth input on every endpoint. - Large app support β serve a pre-exported JSON file instead of generating on every request.
Requirements
| Dependency | Version |
|---|---|
| PHP | ^8.1 |
| Laravel | ^10.0 \| ^11.0 |
| dedoc/scramble | ^0.13 |
Installation
Laravel auto-discovers the service provider. Then open:
Publish the config to customize:
Quick start
Step 1 β Install & visit
Visit /docs/canopy β Canopy auto-generates the tree from your existing Scramble setup.
Step 2 β Add Bearer token support (recommended)
Add this to your AppServiceProvider::boot() so TryIt shows an auth input on every endpoint:
Step 3 β (Large apps) Pre-export the document
For large codebases, generate the spec once instead of on every request:
Then add to .env:
Re-run the export whenever your API changes (e.g. in your CI/CD pipeline).
Grouping
Canopy resolves each endpoint's group in priority order. The first that matches wins:
1. #[Group] attribute (nested with / or >)
2. Config rules
Match conditions: prefix, name, middleware, namespace (all glob-matched).
3. Route prefix / name
Route::prefix('admin/billing') β Admin β Billing. Falls back to the dotted route name (admin.users.index β Admin β Users).
4. Controller name (fallback)
InvoiceController β Invoice. Finally, the configurable fallback group (default General).
Branding
The user can also toggle dark/light mode at any time via the π button in the sidebar header. Preference is saved in
localStorageand overrides the config value.
Publish and customize the view:
Configuration reference
| Key | Default | Description |
|---|---|---|
enabled |
true |
Master switch. When false, Canopy registers nothing. |
api |
'default' |
Scramble API name (for multi-API setups). |
memory_limit |
null |
PHP memory limit for the docs request only (e.g. '1024M', '-1'). null keeps the environment default. |
document_path |
null |
Absolute path to a pre-exported OpenAPI JSON file. When set, Canopy serves it directly. Reads from CANOPY_DOCUMENT_PATH env var. |
route.ui |
'docs/canopy' |
Path of the explorer UI. |
route.document |
'docs/canopy.json' |
Path of the raw JSON document. |
route.middleware |
['web'] |
Middleware applied to both routes. |
branding.title |
'API Documentation' |
Sidebar heading and page title. |
branding.logo |
null |
URL to a logo image shown in the sidebar. |
branding.accent |
'#6366f1' |
Accent color (buttons, active states, focus rings). |
branding.theme |
'system' |
Initial theme: light or dark. |
rules |
[] |
Ordered grouping rules (see Grouping section). |
fallback |
'General' |
Group name when no rule matches. |
Large applications
On big codebases, generating the OpenAPI document on every web request can be slow or exhaust PHP memory.
Option 1 β Raise the memory limit:
Option 2 (Recommended) β Pre-export the document:
Add the export to your deploy script so docs stay in sync with your code.
How it works
- Scramble generates the OpenAPI document (unchanged).
- Canopy maps each documented operation back to its Laravel route.
- A resolver pipeline assigns each route a (possibly nested) group path.
- A tree builder assembles the hierarchy.
- The sidebar renders the tree; Stoplight Elements renders the operation detail.
- Clicking a sidebar link fires
hashchange/popstateevents that Stoplight's internal React Router picks up β no page reload.
No x-tree, no patched OpenApi, no forked Scramble β everything happens inside Canopy.
Testing
Changelog
| Version | Highlights |
|---|---|
| v0.2.2 | Fix: hide Stoplight internal sidebar via JS polling so Canopy's sidebar is the only navigation. |
| v0.2.1 | Feat: dark/light mode toggle button with localStorage persistence; redesigned sidebar UI. |
| v0.2.0 | Fix: mount elements-api once, navigate via pushState + hashchange/popstate events. |
| v0.1.9 | Fix: recreate elements-api on each click with hash pre-set. |
| v0.1.4 | Feat: document_path + memory_limit config options for large apps. |
| v0.1.0 | Initial release: tree grouping, Stoplight Elements integration. |
License
MIT Β© Mohammed Mostafa. Built on top of the excellent Scramble by Roman Lytvynenko.
All versions of canopy with dependencies
dedoc/scramble Version ^0.13
illuminate/contracts Version ^10.0 || ^11.0 || ^12.0 || ^13.0
illuminate/support Version ^10.0 || ^11.0 || ^12.0 || ^13.0