Download the PHP package netresearch/assetpicker-bundle without Composer

On this page you can find all versions of the php package netresearch/assetpicker-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package assetpicker-bundle

AssetPicker Symfony Bundle

This Symfony bundle integrates AssetPicker into Symfony applications: it serves the AssetPicker proxy as a route and renders the picker configuration from your Symfony configuration with a Twig function.

Requirements: PHP 8.4 or later, Symfony 8, netresearch/assetpicker 2.x.

Installation

  1. Install via Composer:

  2. Enable the bundle in config/bundles.php (Symfony Flex does this for you):

  3. Add the AssetPicker configuration in config/packages/asset_picker.yaml. It is passed to the picker as is:

    When several configuration files set asset_picker (for example one per environment), they are merged: maps such as storages recursively, while a list such as pick.types or an empty value replaces the earlier value as a whole. types: [file] in a later file therefore leaves [file], not [file, dir].

  4. (Optional) To use the proxy, import its route in config/routes/asset_picker.yaml. assetpicker_config() then sets proxy.url to the route automatically, unless you configure proxy.url yourself:

    The route is /assetpicker?to=<url>. Use a prefix on the import to move it.

Usage

The picker JavaScript

AssetPicker 2 is a Vue 3 application that you build into your own frontend. It is not published on npm (the assetpicker package on npm is the old 1.3.4), so install it from the Git tag and build it with a bundler that compiles Vue single-file components, for example Vite with @vitejs/plugin-vue or Webpack Encore with enableVueLoader():

A minimal entry point that opens the picker from a button and hands the picked asset to your code:

See the AssetPicker README for createAssetPickerApp, the result format and custom adapters.

The configuration

The Twig function assetpicker_config() returns the asset_picker configuration as JSON, with proxy.url pointing at the proxy route when the route is imported. Render it into a JSON script element and read it from your entry point:

<, > and & in configuration values are escaped, so a value cannot end the script element.

The proxy

Storages that send no CORS headers, such as EnterMediaDB, need the proxy. The route forwards the request to the URL in its to parameter with the application's http_client service, wrapped as described below, and returns the upstream response. Redirects are not followed; their Location is rewritten to go through the route again. A request without to is answered with 400 Bad Request.

The route runs on your application's domain, so the browser sends your application's cookies and HTTP authentication along. The proxy does not forward them: Cookie and Authorization are removed from the forwarded request, and Set-Cookie from the upstream response. A storage that needs a session cookie or an Authorization header therefore cannot be used through the proxy.

Any visitor who can reach the route chooses the target. The proxy therefore refuses targets on private, loopback, link-local and other non-public addresses (127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16 including cloud metadata endpoints, ::1, fc00::/7, fe80::/10 and the rest of Symfony\Component\HttpFoundation\IpUtils::PRIVATE_SUBNETS), and hosts whose name does not resolve. It sends its requests through the service assetpicker.proxy.http_client, a Symfony\Component\HttpClient\NoPrivateNetworkHttpClient around your http_client: it resolves the host name itself, sends the request to the address it checked, and checks the address the connection actually used. A refused target is answered with 403 Forbidden and is not requested. Redirects are not followed by the proxy; the browser follows the rewritten Location through the route again, where the redirect target is checked like any other target. The http_client service itself is not changed, so the rest of your application can still reach internal hosts.

If a storage is on an internal host, redefine assetpicker.proxy.http_client in your config/services.yaml with that host's addresses as the allow list (symfony/http-client 8.1 or later); every other internal address stays refused:

The proxy still reaches every public host. Restrict access to the route with your firewall and access_control if that is not wanted.

Upgrading from 1.x

Version 2 targets AssetPicker 2, which replaced the script-tag picker with a Vue 3 application and no longer ships a built picker.js.

Development

License

MIT


All versions of assetpicker-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
netresearch/assetpicker Version ^2.0
symfony/config Version ^8.0.13
symfony/dependency-injection Version ^8.0.13
symfony/framework-bundle Version ^8.0.13
symfony/http-client Version ^8.0.13
symfony/http-foundation Version ^8.0.13
symfony/http-kernel Version ^8.0.13
symfony/routing Version ^8.0.13
twig/twig Version ^3.27
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package netresearch/assetpicker-bundle contains the following files

Loading the files please wait ...