PHP code example of anthoz69 / anter

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

    

anthoz69 / anter example snippets


'providers' => [
    // other providers ommited
    anthoz69\anter\Providers\AntherServiceProvider::class,
],

AnterStore::store($path, $file)->save();
AnterStore::url($path);
AnterStore::delete($path);

// Store image in /storage/app/public/user/cover
// save() method will return full path of image.
$image = AnterStore::make('user/cover', $request->file('image'));
$image->crop(300, 450)->save(); // Crop image from center size 300px x 450px.
$image->fit(300, 300, true)->save(); // Resize and crop image to 300px x 300px and prevent up size image if set true.
$image->resize(300, true)->save(); // Resize to width 300px and prevent up size image if set true.
$image->width(); // Get width of image.
$image->height(); // Get height of image.

setCurrency($number, $percision = 2); // truncate and round
truncate($number, $percision = 2); // truncate and not round number

isRouteMatch('/admin/*', $class = 'active');

<li class="{{ isRouteMatch('/admin/*', 'active-patent-menu') }}"></li>

// output if url start with /admin/user
<li class="active-patent-menu"></li>

isRoute($routeName = '', $class = 'active');

isRoute('user.create', 'active-color-menu'); // result: active-color-menu
isRoute('user.create'); // result: active

getYoutubeId('https://www.youtube.com/watch?v=aAzUC8vNtgo'); // output: aAzUC8vNtgo
getVimeoId('https://vimeo.com/68529790'); // output: 68529790
getVideoProvider('https://www.youtube.com/watch?v=aAzUC8vNtgo'); // output: youtube

getTHMonth($index, $short = true);
getDateTH($strDate, $shortMonth = true, $time = false);
getTimeFromDate($strDate, $second = true);

getTHMonth(1); // มกราคม
getTHMonth(1, true); // ม.ค.

getDateTH('2019-07-17 16:07:42'); // 17 ก.ค. 2562
getDateTH('2019-07-17 16:07:42', false); // 17 กรกฏาคม 2562
getDateTH('2019-07-17 16:07:42', true, true); // 17 ก.ค. 2562 16:07

getTimeFromDate('2019-07-17 16:07:42'); // 16:07
getTimeFromDate('2019-07-17 16:07:42', true); // 16:07:42