syntaxsapiens/logodev-laravel

A Laravel package that simplifies interaction with the Logo.dev API.

v1.0.0 2025-01-09 21:22 UTC

This package is auto-updated.

Last update: 2025-08-09 22:38:07 UTC


README

Latest Version on Packagist Pest Tests PHPStan Level 5 Total Downloads

This Laravel package provides simple methods for interacting with the Logo.dev API. Logo.dev is an attribution-based freemium API, for more information please visit https://www.logo.dev/pricing.

Disclaimer: This package is not officially affiliated with Logo.dev. All rights and trademarks for the Logo.dev API belong to their respective owners.

Installation

You can install the package via composer:

composer require syntaxsapiens/logodev-laravel

Configuration

You can publish the config file with:

php artisan vendor:publish --tag="logodev-laravel-config"

Below is the content of the published configuration file.

  • The values for LOGODEV_PUBLISHABLE_KEY and LOGODEV_SECRET_KEY can be obtained by signing up for a free account. These should be set in your .env file.
  • The remaining configuration options allow you to define global defaults for image-related settings when using the logo methods.
  • By default, the API uses the values specified in the comments for each configuration line. You can override these defaults on a per-request basis if needed.

For more details, refer to the Logo.dev documentation on logo images.

return [
    'publishable_key' => env('LOGODEV_PUBLISHABLE_KEY'),
    'secret_key' => env('LOGODEV_SECRET_KEY'),
    'size' => null,     // Default: 128
    'format' => null,   // Default: jpg
    'greyscale' => null, // Default: false
    'fallback' => null, // Default: Monogram
];

Usage

The package supports direct instantiation and facade usage.

Logo by Domain

// Direct instantiation
$logoDev = new LogoDev();
echo $logoDev->logoByDomain('google.com');

// Facade usage
echo LogoDev::logoByDomain('google.com');

Logo by Ticker

// Direct instantiation
$logoDev = new LogoDev();
echo $logoDev->logoByTicker('GOOG');

// Facade usage
echo LogoDev::logoByTicker('GOOG');

Request Level Custom Options

// Direct instantiation
$logoDev = new LogoDev();
echo $logoDev->logoByDomain('google.com', [
    'size' => 256,
    'format' => 'png',
    'greyscale' => true,
    'fallback' => 404,
]);

// Facade usage
echo LogoDev::logoByDomain('google.com', [
    'size' => 256,
    'format' => 'png',
    'greyscale' => true,
    'fallback' => 404,
]);

Brand Search

Search for domains by brand name. Returns JSON array with brand / domain key-value pairs. More information.

// Direct instantiation
$logoDev = new LogoDev();
echo $logoDev->brandSearch('apple');

// Facade usage
echo LogoDev::brandSearch('apple');

Describe

Retrieve available brand data for a given domain including name, description, logo and social media links. More information.

// Direct instantiation
$logoDev = new LogoDev();
echo $logoDev->describe('microsoft.com');

// Facade usage
echo LogoDev::describe('microsoft.com');

Attribution Requirement

Before deploying with a free account, you are required on any page you use the Logo API to link back to logo.dev. Attribution links should be legible and indexable. Here’s an example attribution link to use:

<a href="https://logo.dev" alt="Logo API">Logos provided by Logo.dev</a>

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Credits

License

The MIT License (MIT). Please see License File for more information.