Every day useful services for Laravel.
composer require migunov/laravel-services
Migunov\Services\ResponseService::json(
array $data, // Response Data for a client.
array $params = [], // Any parameters what you want send a client
int $status = Response::HTTP_OK // the HTTP status
): JsonResponse
Migunov\Services\Helper::fileExtension(string $path): string
Migunov\Services\Helper::fileExtensionFromMime(string $contentType): string
Migunov\Services\Helper::getMetaTags(string $url): array
Migunov\Services\Helper::host(string $url): string
Migunov\Services\Helper::htmlCut($text, $max_length): string // Dangerous!
Migunov\Services\Helper::httpClient(): PendingRequest
Migunov\Services\Helper::sanitizeData(array $data): array
Migunov\Services\Helper::socialName(string $url): string
Migunov\Services\Helper::stringToArray(
string $value,
string $separator = ','
): array
Migunov\Services\Helper::timeFormat(int $seconds): string // Only English
Migunov\Services\ImageService::resize(
string $path, // Storage path to image file.
int $width = 1200,
int $height = 600,
?string $targetPath = null // Storage path to resized image file or will be replaced $path
): void
/**
* Save main image of a website page.
*
* @param string $url URL to download an image
* @param string $path Path to save an image
* @param array $params [
* 0 => [
* 'name' => null, // autogenerated if null.
* 'width' => 1200,
* 'height' => 600,
* ],
* [
* 'name' => null, // from [0]['name'] if null.
* 'postfix' => '.preview.jpg' // required.
* 'width' => 400,
* 'height' => 400,
* ],
* [
* 'name' => null, // from [0]['name'] if null.
* 'postfix' => '.mini.jpg' // required.
* 'width' => 64,
* 'height' => 64,
* ],
* ]
*/
Migunov\Services\ImageService::saveImageFromUrlPage(
string $url,
string $path,
array $params
): void