Download the PHP package bradietilley/faker-imagez without Composer
On this page you can find all versions of the php package bradietilley/faker-imagez. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bradietilley/faker-imagez
More information about bradietilley/faker-imagez
Files in bradietilley/faker-imagez
Package faker-imagez
Short Description Base system for providing faker images
License MIT
Informations about the package faker-imagez
Images
Introduction
FakerImagez provides an interface for other faker image generators.
Repositories
Imagez available:
Documentation
It's insanely easy to use.
Define your Imagez class, or use one of the above ^
If you're using a package mentioned above, just replace imagez()
in the examples below with the name of the package, such as foodz()
or catz()
.
Get random paths
Each invocation will return a new random path.
Once all image images are exhausted, it'll refeed and continue again with another random order.
Get random contents
Each invocation will return a new random file's contents.
Get SplFileInfo objects
Each invocation will return a new random file as an instance of SplFileInfo
.
Get exact image
Have a favorite? Get specific ones every time using the get
method. This will NOT remove the image from the pool, it will simply fetch the given image.
Get count of images
If you'd like to determine the number of images available, use the count
method. This will NOT count the pool but all images.
Halt iterating for repeat interactions
Sometimes you might want to iterate the pool manually and perform multiple queries to fetch the path, contents or splfile info without having it automatically iterate. You can achieve this using the below approach.
Get all images
Maybe you want to pluck all sample images and do something custom. Easy as. The all
method will return all images (paths), the pool
method will return what's remaining in the pool (paths).
Pool reloading
These are internal functions but they're also public. Might come in handy if you're doing something custom:
Replace all images in the faker
You can also replace all images in the faker using the replaceAll()
method.
Combining generators
Maybe you like catz and dogz and foodz and want your placeholders/avatars to include multiple sources. This can be achieved easily:
Roadmap
- May add customisable filtering like
imagez()->red()->path()
andimagez()->red()->iterate()->getCurrentImagePath()
- May add image intervention as an optional dependency for resizing:
imagez()->resize(128)->path()
- Add more images and packages