2017 © Pedro Peláez
 

library laravel-logo-fetcher

Fetching companies' logos by their domain names

image

mtr-design/laravel-logo-fetcher

Fetching companies' logos by their domain names

  • Thursday, June 22, 2017
  • by andonovn
  • Repository
  • 8 Watchers
  • 0 Stars
  • 522 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Laravel Logo Fetcher

Installation

Require this package with composer:, (*1)

composer require mtr-design/laravel-logo-fetcher

Add the ServiceProvider to the providers array in config/app.php, (*2)

MTRDesign\LaravelLogoFetcher\ServiceProvider::class,

Copy the package config to your local config with the publish command:, (*3)

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, (*4)

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:, (*5)

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

If you want to just fetch the logo:, (*6)

$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:, (*7)

$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, (*8)

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., (*9)

The Versions

22/06 2017

dev-master

9999999-dev

Fetching companies' logos by their domain names

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logo fetcher

22/06 2017

1.0.3

1.0.3.0

Fetching companies' logos by their domain names

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logo fetcher

09/06 2017

1.0.2

1.0.2.0

Fetching companies' logos by their domain names

  Sources   Download

MIT

The Requires

 

laravel logo fetcher

09/06 2017

dev-feature-seperate-fetching-from-storing

dev-feature-seperate-fetching-from-storing

Fetching companies' logos by their domain names

  Sources   Download

MIT

The Requires

 

laravel logo fetcher

08/06 2017

1.0.1

1.0.1.0

Fetching companies' logos by their domain names

  Sources   Download

MIT

The Requires

 

laravel logo fetcher

08/06 2017

1.0

1.0.0.0

Fetching companies' logos by their domain names

  Sources   Download

MIT

The Requires

 

laravel logo fetcher