PHP code example of netflex / files

1. Go to this page and download the library: Download netflex/files 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/ */

    

netflex / files example snippets




use Netflex\Files\File;

$files = File::where('type', 'png')
    ->where('name', 'like', 'Hello*')
    ->where('created', '>=', '2021-11-01')
    ->all();



use Netflex\Files\File;
use Netflex\Query\Builder;

$tags = File::tags();

// Or with a query callback:

$tags = File::tags(function ($query) {
    return $query->where('related_customers', [10000, 10010]);
})

// Or with a query builder:
$query = new Builder;
$tags = File::tags($query->where('type', ['jpg', 'png']));



use Netflex\Files\File;

$taggedImages = File::where('tags', 'netflex')->all();



// $request is either a Form Request or an instance of Illuminate\Http\Request
$file = $request->file('uploaded-file');

$uploadedFile = File::upload($file); // Uploaded to folder '0'.

// You can also upload an external file like this
$uploadedFile = File::upload('https://example.com/test.jpg');

// Or a base64 encoded file:
$uploadedFile = File::upload('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==', [
    'name' => 'test.png' // Name is 



use Netflex\Files\File;

$file = File::find(10000)->copy('new-name.png');



use Netflex\Files\File;

$file = File::find(10000);
$url = media_url($file, 'my-preset-name');
// or
$url = media_url($file, '200x200', MODE_FIT);