Download the PHP package yanick-k/images-faker-lorem without Composer
On this page you can find all versions of the php package yanick-k/images-faker-lorem. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yanick-k/images-faker-lorem
More information about yanick-k/images-faker-lorem
Files in yanick-k/images-faker-lorem
Package images-faker-lorem
Short Description Reliable Lorem.Space image provider for FakerPHP.
License MIT
Informations about the package images-faker-lorem
fakerphp-lorem-space-provider
Reliable Lorem.Space image provider for FakerPHP.
The package adds Faker formatters that generate Lorem.Space URLs or download the generated image into a local directory.
Requirements
- PHP 8.2 or higher
fakerphp/faker- cURL extension recommended for downloads.
allow_url_fopenis supported as a fallback.
Install
Usage
API
loremSpaceUrl(string $category, int $width = 640, int $height = 480): string
Returns a Lorem.Space image URL.
Width and height are clamped to Lorem.Space limits:
- minimum:
8 - maximum:
2000
loremSpace(string $category, ?string $dir = null, int $width = 640, int $height = 480, bool $fullPath = true): string|false
Downloads the image and returns the saved path.
$dirdefaults tosys_get_temp_dir()$fullPath = falsereturns only the generated filename- returns
falsewhen the remote download fails - throws
InvalidArgumentExceptionfor invalid categories, non HTTP(S) URLs, or unwritable directories
Downloads are written to a temporary .part file first, validated as images, then moved into place.
Categories
Use constants from LoremSpaceProvider instead of hard-coded strings:
You can also inspect them dynamically:
Development
Individual checks:
Security and reliability
The downloader only accepts HTTP(S), follows at most three redirects, verifies TLS when cURL is available, applies a 10 second timeout, caps downloads to 20 MB, and validates that the received file is an image before returning it.
License
MIT