{"id":13759794,"url":"https://github.com/humanmade/asset-manager-framework","last_synced_at":"2025-06-30T23:10:15.553Z","repository":{"id":37211366,"uuid":"244678312","full_name":"humanmade/asset-manager-framework","owner":"humanmade","description":"A framework for overriding the WordPress media library with an external asset provider, such as a DAM","archived":false,"fork":false,"pushed_at":"2025-06-13T14:02:23.000Z","size":459,"stargazers_count":175,"open_issues_count":17,"forks_count":7,"subscribers_count":27,"default_branch":"master","last_synced_at":"2025-06-30T16:14:51.100Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/humanmade.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-03T15:54:07.000Z","updated_at":"2025-06-26T14:19:36.000Z","dependencies_parsed_at":"2024-01-17T18:02:15.205Z","dependency_job_id":"f6237c09-20d1-47d5-a78c-4e115f20cb3a","html_url":"https://github.com/humanmade/asset-manager-framework","commit_stats":{"total_commits":195,"total_committers":12,"mean_commits":16.25,"dds":0.5538461538461539,"last_synced_commit":"58e37f495638a40ce6ddab10b400d702cb4883bc"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/humanmade/asset-manager-framework","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fasset-manager-framework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fasset-manager-framework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fasset-manager-framework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fasset-manager-framework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/humanmade","download_url":"https://codeload.github.com/humanmade/asset-manager-framework/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fasset-manager-framework/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262807492,"owners_count":23367439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T13:00:59.220Z","updated_at":"2025-06-30T23:10:15.520Z","avatar_url":"https://github.com/humanmade.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Asset Manager Framework\n\nThis WordPress plugin provides a framework for replacing the contents of the standard WordPress media library with assets from an external provider such as a DAM, another WordPress website, or a central site within a Multisite installation.\n\nIt handles the necessary integration with WordPress (Ajax endpoints and Backbone components) leaving you to focus on just the server-side API connection to your DAM.\n\nThe intention is that the media manager, the block editor, the classic editor, the REST API, XML-RPC, and anything that calls `wp.media()` should \"just work\" and not need to implement changes in order to support a media library that is powered by an external provider.\n\n## Installation\n\nInstall with [Composer](https://getcomposer.org):\n\n```sh\ncomposer require humanmade/asset-manager-framework\n```\n\n## Status\n\nCurrent status: **Alpha.** Generally very functional but several features still in development.\n\nThe following features work as expected:\n\n* [X] Block editor: All media features\n* [X] Classic editor: All media features\n* [X] Media screen: All features\n* [X] Widgets: All media widgets\n* [ ] Customizer:\n    - [X] Background Image\n    - [ ] Logo (functions if you skip cropping)\n    - [ ] Site Icon (unable to skip cropping of large images)\n* [X] REST API media endpoints\n* [X] XML-RPC requests for media\n* [X] Any code that calls `wp.media()` to open the media manager and work with the selected attachments\n\nThe following custom field libraries have been tested and are compatible out of the box:\n\n* [X] CMB2\n* [X] Advanced Custom Fields (ACF)\n* [X] Fieldmanager\n\nThe following third party plugins are supported via an included integration layer:\n\n* [X] MultilingualPress 3\n\nThe following new features are planned but not yet implemented:\n\n* [ ] [Various degrees of read-only media (to prevent local uploading, editing, cropping, or deletion)](https://github.com/humanmade/asset-manager-framework/issues/13)\n* [x] Support for multiple simultaneous media providers\n\nThe following features will *not* be supported:\n\n* Side-loading media from an external media provider. The intention of this framework is that media files remain remotely hosted.\n* Built-in handling of authentication required to communicate with your external media provider. This responsibility lies within your implementation. Consider using [the Keyring plugin](https://wordpress.org/plugins/keyring/) if an OAuth connection is required.\n* Built-in support for any given media provider (such as AEM Assets, Aprimo, Bynder, or ResourceSpace). This is a framework built to be extended in order to connect it to a media provider.\n\n## Known Implementations\n\n* [AMF WordPress](https://github.com/humanmade/amf-wordpress/) for using another WordPress site, or another site on a Multisite network, as source for your media library.\n* [AMF Unsplash](https://github.com/humanmade/amf-unsplash/) for using Unsplash as a source.\n\n## Implementation\n\nThere are two main aspects to the plugin.\n\n1. Allow the media manager grid to display external items which are not existing attachments.\n2. Subsequently create a local attachment for an external item when it's selected for use.\n\nThe design decision behind this is that allowing for external items to be browsed in the media manager is quite straight forward, but unless each item is associated with a local attachment then most of the rest of WordPress breaks when you go to use an item. Previous attempts to do this have involved lying about attachment IDs, or switching to another site on a Multisite network to provide a media item. Neither approach is desirable because such lies need to be maintained and eventually you run into a situation where your lies become unravelled.\n\nAsset Manager Framework instead allows external media items to be browsed in the media library grid, but as soon as an item is selected for use (eg. to be inserted into a post or used as a featured image), an attachment is created for the media item, and this gets returned by the media manager.\n\nThe actual media file does not get sideloaded into WordPress - it intentionally remains at its external URL. The correct external URL gets referred to as necessary, while a local object attachment is maintained that can be referenced and queried within WordPress.\n\n## Integration\n\nThere are two steps needed to integrate a media provider using the Asset Manager Framework:\n\n1. Create a provider which extends the `AssetManagerFramework\\Provider` class and implements its `get_id()`, `get_name()` and `request()` methods to fetch results from your external media provider based on query arguments from the media manager.\n2. Hook into the `amf/register_providers` action to register your provider for use.\n\nFull documentation is coming soon, but for now here's an example of a provider which supplies images from placekitten.com:\n\n```php\nuse AssetManagerFramework\\{\n\tProviderRegistry\n\tProvider,\n\tMediaList,\n\tMediaResponse,\n\tImage\n};\n\nclass KittenProvider extends Provider {\n\n\tpublic function get_id() {\n\t\treturn 'kittens';\n\t}\n\n\tpublic function get_name() {\n\t\treturn __( 'Place Kitten' );\n\t}\n\n\tprotected function request( array $args ) : MediaResponse {\n\t\t$kittens = [\n\t\t\t500 =\u003e 'Boop',\n\t\t\t600 =\u003e 'Fuzzy',\n\t\t\t700 =\u003e 'Paws',\n\t\t];\n\t\t$items = [];\n\n\t\tforeach ( $kittens as $id =\u003e $title ) {\n\t\t\t$item = new Image( $id, 'image/jpeg' );\n\t\t\t$item-\u003eset_url( sprintf(\n\t\t\t\t'https://placekitten.com/%1$d/%1$d',\n\t\t\t\t$id\n\t\t\t) );\n\t\t\t$item-\u003eset_title( $title );\n\t\t\t$item-\u003eset_width( $id );\n\t\t\t$item-\u003eset_height( $id );\n\n\t\t\t$items[] = $item;\n\t\t}\n\n\t\treturn new MediaResponse(\n\t\t\tnew MediaList( ...$items ),\n\t\t\tcount( $kittens ), // Total number of available results.\n\t\t\tcount( $kittens )  // Number of items requested per page.\n\t\t);\n\t}\n\n}\n\nadd_action( 'amf/register_providers', function ( ProviderRegistry $provider_registry ) {\n\t$provider_registry-\u003eregister( new KittenProvider() );\n} );\n```\n\nTry it and your media library will be much improved:\n\n![Kittens](assets/KittenProvider.png)\n\nThe `MediaResponse` object takes a `MediaList` along with the total number of available items and the number of items requested per page. This is to ensure pagination in the media library (introduced in WordPress 5.8) works.\n\nYou also have access to provider instances during registration via the `amf/provider` filter, so you could use it to decorate providers:\n\n```php\nadd_filter( 'amf/provider', function ( Provider $provider ) {\n\tif ( $provider-\u003eget_id() !== 'kittens' ) {\n\t\treturn $provider;\n\t}\n\n\treturn new DecoratingProvider( $provider );\n} );\n```\n\nThis is useful, for example, when you are using a third-party provider implementation and want to change certain behavior.\n\n## Local Media\n\nLocal media is supported by default and can be used side by side with any additional media providers but can also be controlled by using one the following methods:\n\n1. Defining the `AMF_ALLOW_LOCAL_MEDIA` constant as a boolean\n2. Use the `amf/allow_local_media` filter to return a boolean\n3. Use the `amf/local_provider/name` filter to change the `Local Media` label.\n\nThe filter will take precedence over the constant.\n\n# License: GPLv2 #\n\nThis program is free software; you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation; either version 2 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanmade%2Fasset-manager-framework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhumanmade%2Fasset-manager-framework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanmade%2Fasset-manager-framework/lists"}