Download the PHP package co-infra/image without Composer

On this page you can find all versions of the php package co-infra/image. 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 image

Build img.infra.coop URLs and srcsets for AT Protocol blobs.



What is this?

img.infra.coop is a free, public image CDN for the AT Protocol. It takes a blob, resizes and reformats it, and serves the result from a durable edge cache, so apps do not have to hand full-resolution originals to browsers.

This package builds the URLs. It does nothing else: no HTTP, no image processing, no configuration to hold. Give it a DID and a blob CID, get a string back.

It is the PHP twin of the @co-infra/image npm package, and produces byte-identical URLs for the same operations.

Why use it?

Install

Quick example

Operations

Pass an array, or an Operations object for type safety.

Key Type Range Param
width int 1–4096 w
height int 1–4096 h
size int 1–4096 size
dpr float 1–2 dpr
quality int 1–100 q
format Format|string auto, webp, avif, jpeg, png, gif f
fit Fit|string cover, contain, pad, scale-down fit
gravity string auto, an edge, or a point like 0.5x0.3 g
blur int 1–250 blur
sharpen float 0–10 sharpen
rotate int 90, 180, 270 rotate
background string hex, with or without # bg
preset Preset|string see below p

Out-of-range numbers are clamped. A rotation that is not a right angle, or a background that is not hex, throws InvalidOperationException — there is no sensible nearest value for either.

Presets

Named transforms the CDN resolves server-side.

Preset Shape
Preset::AvatarSmall 128px square, smart-cropped
Preset::Avatar 256px square, smart-cropped
Preset::AvatarLarge 512px square, smart-cropped
Preset::Banner 1500×500, 3:1
Preset::Feed 1000px, scaled down
Preset::Thumb 500px square, smart-cropped
Preset::Card 1200×630 JPEG, 1.91:1
Preset::Blur 20px wide, heavily blurred

A preset is a starting point. Anything you set alongside it wins:

The CDN serves its live definitions from /presets and is the source of truth. The enum mirrors it for autocompletion; if the two disagree, the CDN wins.

Private deployments

The public instance is open to everyone, so most apps do not need their own. If you run one, construct a builder with its base URL:

UrlBuilder is a plain injectable object, so a container can bind it once with the configured base and hand it around.

A note on privacy

Every URL this builds is public. The CDN has no viewer authentication, and com.atproto.sync.getBlob is itself public, so a blob in a repo is readable by anyone who knows the DID and CID. Do not use this for anything that is meant to stay private.

Testing

Credits

If you use the public instance, add a small acknowledgement linking to infra.coop somewhere on your site.

License

MIT. See LICENSE.


All versions of image with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
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 co-infra/image contains the following files

Loading the files please wait ...