PHP code example of cybex / laravel-transmorpher-client
1. Go to this page and download the library: Download cybex/laravel-transmorpher-client library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cybex / laravel-transmorpher-client example snippets
class YourModel extends Model implements HasTransmorpherMediaInterface
{
use HasTransmorpherMedia
...
}
// Retrieve all images as a collection, with media name as key and the Image object as value.
$yourModel->images;
// Retrieve all videos as a collection, with media name as key and the Video object as value.
$yourModel->videos;
// Retrieve a single Image object.
$yourModel->image('front');
// Retrieve a single Video object.
$yourModel->video('teaser');
// Retrieve the 'back' Image instance.
$image = $yourModel->image('back');
// Upload an image to the media server.
$image->upload($fileHandle);
// Get the public URL of the image for retrieving a derivative.
// Transformations are optional and will be
class YourModel extends Model implements HasTransmorpherMediaInterface
{
use HasTransmorpherMedia;
protected string $transmorpherAlias = 'yourAlias';
...
}