{"id":36988954,"url":"https://github.com/tigusigalpa/coingecko-php","last_synced_at":"2026-01-13T23:27:55.077Z","repository":{"id":329265787,"uuid":"1118654143","full_name":"tigusigalpa/coingecko-php","owner":"tigusigalpa","description":"A comprehensive PHP/Laravel package for seamless CoinGecko API integration. Get real-time cryptocurrency prices, market data, historical charts, OHLC data, and more. Supports all CoinGecko endpoints including coins, tokens, contracts, and supply charts. Easy setup with Laravel service provider and facade. Pro API ready.","archived":false,"fork":false,"pushed_at":"2025-12-18T11:02:53.000Z","size":11,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-21T17:47:58.556Z","etag":null,"topics":["api","coingecko","coingecko-api","coingecko-client","crypto","cryptocurrency","laravel","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tigusigalpa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-18T04:51:12.000Z","updated_at":"2025-12-19T08:12:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/tigusigalpa/coingecko-php","commit_stats":null,"previous_names":["tigusigalpa/coingecko-php"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/tigusigalpa/coingecko-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tigusigalpa%2Fcoingecko-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tigusigalpa%2Fcoingecko-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tigusigalpa%2Fcoingecko-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tigusigalpa%2Fcoingecko-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tigusigalpa","download_url":"https://codeload.github.com/tigusigalpa/coingecko-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tigusigalpa%2Fcoingecko-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28403927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","coingecko","coingecko-api","coingecko-client","crypto","cryptocurrency","laravel","php"],"created_at":"2026-01-13T23:27:54.410Z","updated_at":"2026-01-13T23:27:55.070Z","avatar_url":"https://github.com/tigusigalpa.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CoinGecko PHP/Laravel API Client\n\n\u003cdiv align=\"center\"\u003e\n\n![CoinGecko PHP SDK](https://github.com/user-attachments/assets/bab9bea7-a93c-445f-8db3-862576b96977)\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/tigusigalpa/coingecko-php.svg?style=flat-square)](https://packagist.org/packages/tigusigalpa/coingecko-php)\n[![Total Downloads](https://img.shields.io/packagist/dt/tigusigalpa/coingecko-php.svg?style=flat-square)](https://packagist.org/packages/tigusigalpa/coingecko-php)\n[![License](https://img.shields.io/packagist/l/tigusigalpa/coingecko-php.svg?style=flat-square)](https://packagist.org/packages/tigusigalpa/coingecko-php)\n\nA comprehensive, modern PHP/Laravel package for seamless integration with\nthe [CoinGecko API](https://www.coingecko.com/en/api). Get real-time cryptocurrency prices, market data, historical\ncharts, and more with an elegant, developer-friendly interface.\n\n[Features](#features) • [Installation](#installation) • [Quick Start](#quick-start) • [Documentation](#documentation) • [Examples](#examples)\n\n\u003c/div\u003e\n\n---\n\n## 🚀 Features\n\n- ✅ **Complete API Coverage** - All CoinGecko API endpoints implemented\n- 🔐 **Pro API Support** - Full support for CoinGecko Pro API with authentication\n- 🎯 **Laravel Integration** - Service provider, facade, and configuration out of the box\n- 💎 **Modern PHP** - Built with PHP 8.0+ features and best practices\n- 🛡️ **Type Safety** - Fully typed parameters and return values\n- 📦 **Zero Configuration** - Works immediately with sensible defaults\n- 🔄 **Flexible** - Use as standalone PHP library or Laravel package\n- 🎨 **Clean API** - Intuitive, chainable methods for better developer experience\n- ⚡ **Performance** - Efficient HTTP client with connection pooling\n- 📚 **Well Documented** - Comprehensive examples and API reference\n\n## 📋 Requirements\n\n- PHP 8.0 or higher\n- Laravel 9.x, 10.x, or 11.x (for Laravel integration)\n- Guzzle HTTP client 7.x\n\n## 📦 Installation\n\nInstall the package via Composer:\n\n```bash\ncomposer require tigusigalpa/coingecko-php\n```\n\n### Laravel Setup\n\nThe package will automatically register its service provider. Publish the configuration file:\n\n```bash\nphp artisan vendor:publish --tag=coingecko-config\n```\n\nAdd your CoinGecko API credentials to your `.env` file:\n\n```env\nCOINGECKO_API_KEY=your-api-key-here\nCOINGECKO_IS_PRO=false\n```\n\n\u003e **Note:** API key is optional for free tier. Set `COINGECKO_IS_PRO=true` if you have a Pro API subscription.\n\n## 🎯 Quick Start\n\n### Standalone PHP Usage\n\n```php\nuse Tigusigalpa\\Coingecko\\Coingecko;\n\n// Initialize client (no API key needed for free tier)\n$coingecko = new Coingecko();\n\n// Get Bitcoin price in USD\n$price = $coingecko-\u003esimple()-\u003eprice('bitcoin', 'usd');\necho \"Bitcoin: $\" . $price['bitcoin']['usd'];\n\n// With Pro API\n$coingecko = new Coingecko('your-api-key', true);\n```\n\n### Laravel Usage\n\n```php\nuse Tigusigalpa\\Coingecko\\Facades\\Coingecko;\n\n// Using Facade\n$price = Coingecko::simple()-\u003eprice('bitcoin', 'usd');\n\n// Using Dependency Injection\nuse Tigusigalpa\\Coingecko\\Coingecko;\n\nclass CryptoController extends Controller\n{\n    public function __construct(private Coingecko $coingecko)\n    {\n    }\n\n    public function index()\n    {\n        $markets = $this-\u003ecoingecko-\u003ecoins()-\u003emarkets('usd', perPage: 10);\n        return view('crypto.index', compact('markets'));\n    }\n}\n```\n\n## 📖 Documentation\n\n### API Endpoints\n\nThe package is organized into logical API groups:\n\n- **[Simple API](#simple-api)** - Quick price lookups and supported currencies\n- **[Coins API](#coins-api)** - Comprehensive coin data, markets, and historical charts\n- **[Contract API](#contract-api)** - Token data by contract address\n- **[Ping API](#ping-api)** - Server status and API usage\n\n---\n\n### Simple API\n\nGet cryptocurrency prices and basic market data quickly.\n\n#### Get Coin Prices\n\n```php\n// Single coin, single currency\n$price = $coingecko-\u003esimple()-\u003eprice('bitcoin', 'usd');\n// Returns: ['bitcoin' =\u003e ['usd' =\u003e 45000]]\n\n// Multiple coins, multiple currencies\n$prices = $coingecko-\u003esimple()-\u003eprice(\n    ids: ['bitcoin', 'ethereum', 'cardano'],\n    vsCurrencies: ['usd', 'eur', 'gbp'],\n    includeMarketCap: true,\n    include24hrVol: true,\n    include24hrChange: true\n);\n\n// Example response:\n// [\n//     'bitcoin' =\u003e [\n//         'usd' =\u003e 45000,\n//         'eur' =\u003e 42000,\n//         'usd_market_cap' =\u003e 850000000000,\n//         'usd_24h_vol' =\u003e 35000000000,\n//         'usd_24h_change' =\u003e 2.5\n//     ],\n//     ...\n// ]\n```\n\n#### Get Token Prices by Contract Address\n\n```php\n// Get price for a token on Ethereum\n$tokenPrice = $coingecko-\u003esimple()-\u003etokenPrice(\n    assetPlatform: 'ethereum',\n    contractAddresses: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', // UNI token\n    vsCurrencies: 'usd',\n    includeMarketCap: true,\n    include24hrVol: true\n);\n```\n\n#### Get Supported Currencies\n\n```php\n$currencies = $coingecko-\u003esimple()-\u003esupportedVsCurrencies();\n// Returns: ['usd', 'eur', 'gbp', 'jpy', ...]\n```\n\n---\n\n### Coins API\n\nAccess detailed coin information, market data, and historical charts.\n\n#### List All Coins\n\n```php\n// Get list of all coins with IDs\n$coinsList = $coingecko-\u003ecoins()-\u003elist();\n\n// Include platform information\n$coinsWithPlatforms = $coingecko-\u003ecoins()-\u003elist(includePlatform: true);\n```\n\n#### Top Gainers \u0026 Losers\n\n```php\n$topMovers = $coingecko-\u003ecoins()-\u003etopGainersLosers(\n    vsCurrency: 'usd',\n    duration: '24h',\n    topCoins: 100\n);\n\n// Returns top gainers and losers with percentage changes\n```\n\n#### Recently Added Coins\n\n```php\n$newCoins = $coingecko-\u003ecoins()-\u003erecentlyAdded();\n```\n\n#### Coins Market Data\n\n```php\n// Get top 100 coins by market cap\n$markets = $coingecko-\u003ecoins()-\u003emarkets(\n    vsCurrency: 'usd',\n    order: 'market_cap_desc',\n    perPage: 100,\n    page: 1,\n    sparkline: true,\n    priceChangePercentage: '1h,24h,7d'\n);\n\n// Filter by specific coins\n$specificCoins = $coingecko-\u003ecoins()-\u003emarkets(\n    vsCurrency: 'usd',\n    ids: ['bitcoin', 'ethereum', 'cardano']\n);\n\n// Filter by category\n$defiCoins = $coingecko-\u003ecoins()-\u003emarkets(\n    vsCurrency: 'usd',\n    category: 'decentralized-finance-defi',\n    perPage: 50\n);\n```\n\n#### Detailed Coin Data\n\n```php\n// Get comprehensive data for a specific coin\n$bitcoin = $coingecko-\u003ecoins()-\u003ecoin(\n    id: 'bitcoin',\n    localization: true,\n    tickers: true,\n    marketData: true,\n    communityData: true,\n    developerData: true,\n    sparkline: true\n);\n\n// Access various data points:\n// $bitcoin['market_data']['current_price']['usd']\n// $bitcoin['market_data']['market_cap']['usd']\n// $bitcoin['market_data']['total_volume']['usd']\n// $bitcoin['community_data']['twitter_followers']\n// $bitcoin['developer_data']['stars']\n```\n\n#### Coin Tickers\n\n```php\n// Get all trading pairs for a coin\n$tickers = $coingecko-\u003ecoins()-\u003etickers(\n    id: 'bitcoin',\n    exchangeIds: ['binance', 'coinbase'],\n    page: 1,\n    order: 'volume_desc'\n);\n```\n\n#### Historical Data\n\n```php\n// Get coin data at a specific date\n$historicalData = $coingecko-\u003ecoins()-\u003ehistory(\n    id: 'bitcoin',\n    date: '30-12-2023', // DD-MM-YYYY format\n    localization: false\n);\n```\n\n#### Market Chart Data\n\n```php\n// Get price, market cap, and volume chart data\n$chartData = $coingecko-\u003ecoins()-\u003emarketChart(\n    id: 'bitcoin',\n    vsCurrency: 'usd',\n    days: 30, // 1, 7, 14, 30, 90, 180, 365, 'max'\n    interval: 'daily' // optional: 'daily' or 'hourly'\n);\n\n// Returns:\n// [\n//     'prices' =\u003e [[timestamp, price], ...],\n//     'market_caps' =\u003e [[timestamp, market_cap], ...],\n//     'total_volumes' =\u003e [[timestamp, volume], ...]\n// ]\n\n// Get chart data for specific time range\n$rangeData = $coingecko-\u003ecoins()-\u003emarketChartRange(\n    id: 'ethereum',\n    vsCurrency: 'usd',\n    from: 1609459200, // Unix timestamp\n    to: 1640995200,   // Unix timestamp\n    precision: '2'\n);\n```\n\n#### OHLC Chart Data\n\n```php\n// Get candlestick (OHLC) data\n$ohlc = $coingecko-\u003ecoins()-\u003eohlc(\n    id: 'bitcoin',\n    vsCurrency: 'usd',\n    days: 7 // 1, 7, 14, 30, 90, 180, 365\n);\n\n// Returns: [[timestamp, open, high, low, close], ...]\n```\n\n#### Supply Charts\n\n```php\n// Circulating supply chart\n$circulatingSupply = $coingecko-\u003ecoins()-\u003ecirculatingSupplyChart(\n    id: 'bitcoin',\n    days: 30,\n    interval: 'daily'\n);\n\n// Circulating supply for specific time range\n$circulatingRange = $coingecko-\u003ecoins()-\u003ecirculatingSupplyChartRange(\n    id: 'bitcoin',\n    from: 1609459200,\n    to: 1640995200\n);\n\n// Total supply chart\n$totalSupply = $coingecko-\u003ecoins()-\u003etotalSupplyChart(\n    id: 'ethereum',\n    days: 90\n);\n\n// Total supply for specific time range\n$totalRange = $coingecko-\u003ecoins()-\u003etotalSupplyChartRange(\n    id: 'ethereum',\n    from: 1609459200,\n    to: 1640995200\n);\n```\n\n---\n\n### Contract API\n\nGet token data using contract addresses on various blockchain platforms.\n\n#### Get Token Data by Contract Address\n\n```php\n// Get comprehensive token data\n$tokenData = $coingecko-\u003econtract()-\u003ecoin(\n    assetPlatform: 'ethereum',\n    contractAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984' // UNI token\n);\n\n// Supported platforms: ethereum, binance-smart-chain, polygon-pos, \n// avalanche, arbitrum-one, optimistic-ethereum, etc.\n```\n\n#### Token Market Chart by Contract\n\n```php\n// Get price chart for a token\n$tokenChart = $coingecko-\u003econtract()-\u003emarketChart(\n    assetPlatform: 'ethereum',\n    contractAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',\n    vsCurrency: 'usd',\n    days: 30\n);\n\n// Get chart data for specific time range\n$tokenRangeChart = $coingecko-\u003econtract()-\u003emarketChartRange(\n    assetPlatform: 'ethereum',\n    contractAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',\n    vsCurrency: 'usd',\n    from: 1609459200,\n    to: 1640995200\n);\n```\n\n---\n\n### Ping API\n\nCheck API server status and monitor your API usage.\n\n#### Check Server Status\n\n```php\n$status = $coingecko-\u003eping()-\u003eping();\n// Returns: ['gecko_says' =\u003e '(V3) To the Moon!']\n```\n\n#### Check API Usage (Pro API only)\n\n```php\n$usage = $coingecko-\u003eping()-\u003eapiUsage();\n// Returns information about your API key usage and rate limits\n```\n\n---\n\n## 💡 Examples\n\n### Real-World Use Cases\n\n#### Portfolio Tracker\n\n```php\nuse Tigusigalpa\\Coingecko\\Facades\\Coingecko;\n\nclass PortfolioService\n{\n    public function getPortfolioValue(array $holdings): float\n    {\n        $coinIds = array_keys($holdings);\n        $prices = Coingecko::simple()-\u003eprice($coinIds, 'usd');\n        \n        $totalValue = 0;\n        foreach ($holdings as $coinId =\u003e $amount) {\n            $totalValue += $prices[$coinId]['usd'] * $amount;\n        }\n        \n        return $totalValue;\n    }\n}\n\n// Usage\n$portfolio = [\n    'bitcoin' =\u003e 0.5,\n    'ethereum' =\u003e 10,\n    'cardano' =\u003e 1000\n];\n\n$service = new PortfolioService();\n$value = $service-\u003egetPortfolioValue($portfolio);\necho \"Portfolio Value: $\" . number_format($value, 2);\n```\n\n#### Price Alert System\n\n```php\nuse Tigusigalpa\\Coingecko\\Coingecko;\n\nclass PriceAlertChecker\n{\n    public function __construct(private Coingecko $coingecko)\n    {\n    }\n\n    public function checkAlerts(array $alerts): array\n    {\n        $coinIds = array_unique(array_column($alerts, 'coin_id'));\n        $prices = $this-\u003ecoingecko-\u003esimple()-\u003eprice(\n            ids: $coinIds,\n            vsCurrencies: 'usd',\n            include24hrChange: true\n        );\n        \n        $triggered = [];\n        foreach ($alerts as $alert) {\n            $currentPrice = $prices[$alert['coin_id']]['usd'];\n            \n            if ($alert['type'] === 'above' \u0026\u0026 $currentPrice \u003e= $alert['target_price']) {\n                $triggered[] = $alert;\n            } elseif ($alert['type'] === 'below' \u0026\u0026 $currentPrice \u003c= $alert['target_price']) {\n                $triggered[] = $alert;\n            }\n        }\n        \n        return $triggered;\n    }\n}\n```\n\n#### Market Analysis Dashboard\n\n```php\nuse Tigusigalpa\\Coingecko\\Facades\\Coingecko;\n\nclass MarketAnalyzer\n{\n    public function getDashboardData(): array\n    {\n        // Get top 10 coins by market cap\n        $topCoins = Coingecko::coins()-\u003emarkets(\n            vsCurrency: 'usd',\n            order: 'market_cap_desc',\n            perPage: 10,\n            sparkline: true,\n            priceChangePercentage: '1h,24h,7d,30d'\n        );\n        \n        // Get top gainers and losers\n        $movers = Coingecko::coins()-\u003etopGainersLosers('usd', '24h', 100);\n        \n        // Get recently added coins\n        $newCoins = Coingecko::coins()-\u003erecentlyAdded();\n        \n        return [\n            'top_coins' =\u003e $topCoins,\n            'gainers' =\u003e array_slice($movers['top_gainers'] ?? [], 0, 5),\n            'losers' =\u003e array_slice($movers['top_losers'] ?? [], 0, 5),\n            'new_listings' =\u003e array_slice($newCoins, 0, 5)\n        ];\n    }\n}\n```\n\n#### Historical Price Comparison\n\n```php\nuse Tigusigalpa\\Coingecko\\Coingecko;\n\nclass PriceComparison\n{\n    public function __construct(private Coingecko $coingecko)\n    {\n    }\n\n    public function compareCoins(array $coinIds, int $days = 30): array\n    {\n        $comparison = [];\n        \n        foreach ($coinIds as $coinId) {\n            $chartData = $this-\u003ecoingecko-\u003ecoins()-\u003emarketChart(\n                id: $coinId,\n                vsCurrency: 'usd',\n                days: $days\n            );\n            \n            $prices = array_column($chartData['prices'], 1);\n            $startPrice = reset($prices);\n            $endPrice = end($prices);\n            $change = (($endPrice - $startPrice) / $startPrice) * 100;\n            \n            $comparison[$coinId] = [\n                'start_price' =\u003e $startPrice,\n                'end_price' =\u003e $endPrice,\n                'change_percent' =\u003e round($change, 2),\n                'chart_data' =\u003e $chartData['prices']\n            ];\n        }\n        \n        return $comparison;\n    }\n}\n\n// Usage\n$comparison = new PriceComparison(new Coingecko());\n$results = $comparison-\u003ecompareCoins(['bitcoin', 'ethereum', 'cardano'], 90);\n```\n\n#### DeFi Token Tracker\n\n```php\nuse Tigusigalpa\\Coingecko\\Facades\\Coingecko;\n\nclass DeFiTracker\n{\n    public function trackToken(string $platform, string $contractAddress): array\n    {\n        // Get token data\n        $tokenData = Coingecko::contract()-\u003ecoin($platform, $contractAddress);\n        \n        // Get 7-day price chart\n        $priceChart = Coingecko::contract()-\u003emarketChart(\n            assetPlatform: $platform,\n            contractAddress: $contractAddress,\n            vsCurrency: 'usd',\n            days: 7\n        );\n        \n        return [\n            'name' =\u003e $tokenData['name'],\n            'symbol' =\u003e $tokenData['symbol'],\n            'current_price' =\u003e $tokenData['market_data']['current_price']['usd'],\n            'market_cap' =\u003e $tokenData['market_data']['market_cap']['usd'],\n            'total_volume' =\u003e $tokenData['market_data']['total_volume']['usd'],\n            'price_change_24h' =\u003e $tokenData['market_data']['price_change_percentage_24h'],\n            'chart' =\u003e $priceChart\n        ];\n    }\n}\n\n// Usage - Track Uniswap (UNI) token\n$tracker = new DeFiTracker();\n$uniData = $tracker-\u003etrackToken('ethereum', '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984');\n```\n\n---\n\n## 🔧 Advanced Configuration\n\n### Custom HTTP Client Options\n\n```php\nuse Tigusigalpa\\Coingecko\\CoingeckoClient;\nuse GuzzleHttp\\Client;\n\n// Create custom Guzzle client with specific options\n$httpClient = new Client([\n    'timeout' =\u003e 60,\n    'connect_timeout' =\u003e 10,\n    'verify' =\u003e true,\n    'proxy' =\u003e 'http://proxy.example.com:8080'\n]);\n\n// Note: You can extend CoingeckoClient to use custom HTTP client\n```\n\n### Error Handling\n\n```php\nuse Tigusigalpa\\Coingecko\\Facades\\Coingecko;\nuse Tigusigalpa\\Coingecko\\Exceptions\\CoingeckoException;\n\ntry {\n    $price = Coingecko::simple()-\u003eprice('bitcoin', 'usd');\n} catch (CoingeckoException $e) {\n    // Handle API errors\n    Log::error('CoinGecko API Error: ' . $e-\u003egetMessage());\n    \n    // You can also check the status code\n    $statusCode = $e-\u003egetCode();\n    \n    if ($statusCode === 429) {\n        // Rate limit exceeded\n        return response()-\u003ejson(['error' =\u003e 'Rate limit exceeded'], 429);\n    }\n}\n```\n\n### Rate Limiting\n\nCoinGecko API has rate limits:\n\n- **Free API**: 10-50 calls/minute\n- **Pro API**: Higher limits based on your plan\n\nThe package doesn't implement automatic rate limiting, so you should implement your own caching strategy:\n\n```php\nuse Illuminate\\Support\\Facades\\Cache;\nuse Tigusigalpa\\Coingecko\\Facades\\Coingecko;\n\nclass CachedCoinGeckoService\n{\n    public function getPrice(string $coinId, string $currency): array\n    {\n        $cacheKey = \"coingecko_price_{$coinId}_{$currency}\";\n        \n        return Cache::remember($cacheKey, now()-\u003eaddMinutes(5), function () use ($coinId, $currency) {\n            return Coingecko::simple()-\u003eprice($coinId, $currency);\n        });\n    }\n}\n```\n\n---\n\n## 🧪 Testing\n\n```bash\ncomposer test\n```\n\n## 📝 Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 🔒 Security\n\nIf you discover any security-related issues, please email sovletig@gmail.com instead of using the issue tracker.\n\n## 📄 License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n\n## 🙏 Credits\n\n- [Igor Sazonov](https://github.com/tigusigalpa)\n- [CoinGecko](https://www.coingecko.com) for providing the API\n- All [contributors](https://github.com/tigusigalpa/coingecko-php/contributors)\n\n## 🔗 Links\n\n- **Package\n  **: [https://packagist.org/packages/tigusigalpa/coingecko-php](https://packagist.org/packages/tigusigalpa/coingecko-php)\n- **Repository**: [https://github.com/tigusigalpa/coingecko-php](https://github.com/tigusigalpa/coingecko-php)\n- **CoinGecko API Documentation**: [https://docs.coingecko.com](https://docs.coingecko.com)\n- **CoinGecko Website**: [https://www.coingecko.com](https://www.coingecko.com)\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n**[⬆ back to top](#coingecko-phplaravel-api-client)**\n\nMade with ❤️ by [Igor Sazonov](https://github.com/tigusigalpa)\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftigusigalpa%2Fcoingecko-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftigusigalpa%2Fcoingecko-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftigusigalpa%2Fcoingecko-php/lists"}