mtr-design/laravel-logo-fetcher 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mtr-design/laravel-logo-fetcher

Composer 安装命令:

composer require mtr-design/laravel-logo-fetcher

包简介

Fetching companies' logos by their domain names

README 文档

README

Installation

Require this package with composer:

composer require mtr-design/laravel-logo-fetcher

Add the ServiceProvider to the providers array in config/app.php

MTRDesign\LaravelLogoFetcher\ServiceProvider::class,

Copy the package config to your local config with the publish command:

php artisan vendor:publish --provider="MTRDesign\LaravelLogoFetcher\ServiceProvider"

You now should have config/logo_fetcher.php file. You can open and tweak the configuration options

Usage

  1. Resolve the \MTRDesign\LaravelLogoFetcher\LogoFetcher class from the container
  2. Set a provider using the provider() method
  3. Call the fetch() method to get the logo
  4. You can chain with store() to save it using your default storage disk

If you want to directly store the logo:

$logoFetcher = app(\MTRDesign\LaravelLogoFetcher\LogoFetcher::class);
$logoFetcher->provider(Clearbit::class)
    ->fetch($domain)
    ->store();

If you want to just fetch the logo:

$logoFetcher = app(\MTRDesign\LaravelLogoFetcher\LogoFetcher::class);
$logo = $logoFetcher
    ->provider(Clearbit::class)
    ->fetch($domain)
    ->logo;

One extra example to illustrate the domain() helper and the path property, assuming that you injected the logo fetcher class:

$path = $this->logoFetcher
    ->provider(Clearbit::class)
    ->domain($domain)
    ->fetch()
    ->store()
    ->path;

Providers

You can define your own providers - just create a class and implement the MTRDesign\LaravelLogoFetcher\Providers\ProviderContract

Error handling

Different exceptions will be raised if the fetching fails but they all inherit from the \MTRDesign\LaravelLogoFetcher\Exceptions\LogoFetcherException. All are having human-readable messages and can be safely output to the client. You can find all the exceptions in the \MTRDesign\LaravelLogoFetcher\Exceptions namespace.

统计信息

  • 总下载量: 564
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 8
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-06-08

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固