Download the PHP package lychee-org/php-flickr-justified-layout without Composer

On this page you can find all versions of the php package lychee-org/php-flickr-justified-layout. 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 php-flickr-justified-layout

Flickr's Justified Layout in PHP

Build Status Coverage Status

Pass in box sizes and get back sizes and coordinates for a nice justified layout like that seen all over Flickr. The explore page is a great example. Here's another example using the fullWidthBreakoutRowCadence option on Flickr's album page.

It converts this (simplified):

Into this (simplified):

Which gives you everything you need to make something like this:

Demonstration

Why?

Instead of relying on another JS dependency to apply those computations on the client side, this allows us to do them on server side (assuming we know the intended width of the container).

It does come with the constraint that reformating the window may have uninteded effect.

Install

composer require lychee-org/php-flickr-justified-layout

Easy Usage

Objects passed to the compute method must implement the AspectRatio or WidthHeight interface.

Configuration

See Config Object:

Parameter Type Default Description
$containerWidth int 1060 The width that boxes will be contained within irrelevant of padding.
$containerPadding int\|LeftRightTopBottom 10 Provide a single integer to apply padding to all sides or provide a LRTB object to apply individual values to each side.
$boxSpacing int\|HorizontalVertical 10 Provide a single integer to apply spacing both horizontally and vertically or provide a HV object to apply individual values to each axis.
$targetRowHeight int 320 It's called a target because row height is the lever we use in order to fit everything in nicely. The algorithm will get as close to the target row height as it can.
$targetRowHeightTolerance float 0.25 How far row heights can stray from targetRowHeight. 0 would force rows to be the targetRowHeight exactly and would likely make it impossible to justify. The value must be between 0 and 1.
$maxNumRows false\|int false Will stop adding rows at this number regardless of how many items still need to be laid out.
$forceAspectRatio false\|float false Provide an aspect ratio here to return everything in that aspect ratio. Makes the values in your input array irrelevant. The length of the array remains relevant.
$showWidows bool true By default we'll return items at the end of a justified layout even if they don't make a full row. If false they'll be omitted from the output.
$fullWidthBreakoutRowCadence false\|int false If you'd like to insert a full width box every n rows you can specify it with this parameter. The box on that row will ignore the targetRowHeight, make itself as wide as containerWidth - containerPadding and be as tall as its aspect ratio defines. It'll only happen if that item has an aspect ratio >= 1. Best to have a look at the examples to see what this does.
$widowLayoutStyle string justify Justify for the widows, possible values are left, center and justify

Open Source Community Support

PhpStorm

We would like to thank Jetbrains for supporting us with their Open Source Development - Community Support program.


All versions of php-flickr-justified-layout with dependencies

PHP Build Version
Package Version
Requires illuminate/collections Version ^10.10
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 lychee-org/php-flickr-justified-layout contains the following files

Loading the files please wait ....