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
   
    ...
}

protected array $transmorpherImages = [
    'front',
    'back'
];

protected array $transmorpherVideos = [
    'teaser'
];

// 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';
    
    ...
}
bash
php artisan migrate
bash
php artisan vendor:publish --tag=transmorpher.config
bash
php artisan vendor:publish --tag=transmorpher.assets
json
{
  "scripts": {
    "post-update-cmd": [
      "@php artisan vendor:publish --tag=transmorpher.assets --ansi --force"
    ]
  }
}
bash
php artisan vendor:publish --tag=transmorpher.views
bash
php artisan create:user pullpreview [email protected] http://pullpreview.test/transmorpher/notifications