invezgo/sdk
Composer 安装命令:
composer require invezgo/sdk
包简介
Official PHP SDK for Invezgo API - Data Saham Indonesia
README 文档
README
Official PHP SDK for Invezgo API - Data Saham Indonesia
Installation
Install via Composer:
composer require invezgo/invezgo-php-sdk
Requirements
- PHP 7.4 or higher
- Guzzle HTTP Client 6.0 or higher
Getting Started
Basic Usage
<?php require 'vendor/autoload.php'; use Invezgo\InvezgoClient; // Initialize the client with your API key $client = new InvezgoClient('your-api-key-here'); // Get list of stocks $stocks = $client->analysis()->getStockList(); print_r($stocks); // Get company information $info = $client->analysis()->information('BBCA'); print_r($info);
Authentication
You need an API key to use this SDK. Get your API key from Invezgo API Settings.
Note: You must have an active subscription package to use the API.
Usage Examples
Analysis Service - Data Saham Indonesia
Get Stock List
$stocks = $client->analysis()->getStockList(); // Returns: [{"code":"BBCA","name":"Bank Central Asia","logo":"..."}, ...]
Get Company Information
$info = $client->analysis()->information('BBCA');
Get Top Gainer & Loser
$topChange = $client->analysis()->topChange('2024-12-30');
Get Stock Chart
$chart = $client->analysis()->getAdvanceChart('BBCA', '2024-12-01', '2024-12-30');
Get Intraday Chart
$intraday = $client->analysis()->getIntradayChart('BBCA', 'RG');
Get Financial Statement
// Balance Sheet (BS), Income Statement (IS), Cash Flow (CF) // Period: FY (Annual), Q (Quarterly), Q1-Q4 (Specific Quarter) $financial = $client->analysis()->financialStatement('BBCA', 'BS', 'Q', 10);
Get Broker Summary
$summary = $client->analysis()->summaryStock( 'BBCA', // Stock code '2024-12-01', // From date '2024-12-30', // To date 'all', // Investor: all, f (foreign), d (domestic) 'RG' // Market: RG (Regular), NG (Negotiated), TN (Cash) );
Get Shareholder Data
// Get shareholder composition $shareholder = $client->analysis()->shareholder('BBCA'); // Get KSEI shareholder data $ksei = $client->analysis()->shareholderKSEI('BBCA', 6); // 6 months // Get insider trading $insider = $client->analysis()->insider('2024-12-01', '2024-12-30', 10, 1);
Watchlists Service - Personal
// Get watchlist groups $groups = $client->watchlists()->listGroupWatchlist(); // Get watchlists $watchlists = $client->watchlists()->listWatchlist('group-id'); // Add to watchlist $result = $client->watchlists()->addWatchlist([ 'stock_code' => 'BBCA', 'group_id' => 'group-id', // ... other fields ]);
Journals Service - Personal
// List journal transactions $journals = $client->journals()->listTransactions(); // Add journal transaction $result = $client->journals()->addTransaction([ 'stock_code' => 'BBCA', 'transaction_type' => 'buy', 'price' => 10000, 'quantity' => 100, // ... other fields ]); // Get summary $summary = $client->journals()->getTransactionsSummary();
Portfolios Service - Personal
// List portfolios $portfolios = $client->portfolios()->listPortfolio(); // Get portfolio summary $summary = $client->portfolios()->portfolioSummary();
AI Service - AI Chat
// AI analysis for KSEI shareholder $analysis = $client->ai()->shareholderKSEI('BBCA'); // AI analysis for news $news = $client->ai()->news('BBCA'); // AI analysis for broker summary $analysis = $client->ai()->brokerSummary('BBCA', '2024-12-01', '2024-12-30', 'all', 'RG');
Search Service
// Search stock or user $results = $client->search()->search('BBCA'); // Search stock only $stocks = $client->search()->searchStock('BCA', 'cursor'); // Search user only $users = $client->search()->searchUser('username', 'cursor');
Profile Service
// Get user profile $profile = $client->profile()->userDetails('username'); // Get user posts $posts = $client->profile()->userPosts('username', '1', '10'); // Get user watchlist $watchlist = $client->profile()->listWatchlist('username');
Posts Service
// Get all posts $posts = $client->posts()->getPosts(); // Get posts by category $posts = $client->posts()->getCategoryPosts('category'); // Get stock posts $posts = $client->posts()->getStockPosts('BBCA'); // Get post detail $post = $client->posts()->getPostById('post-id');
Health Service
// Check API status $status = $client->health()->check(); // Check database status $dbStatus = $client->health()->checkDatabase(); // Full check $fullStatus = $client->health()->fullCheck();
Error Handling
The SDK throws specific exceptions for different error scenarios:
use Invezgo\Exception\ApiException; use Invezgo\Exception\AuthenticationException; use Invezgo\Exception\PaymentRequiredException; use Invezgo\Exception\RateLimitException; try { $stocks = $client->analysis()->getStockList(); } catch (AuthenticationException $e) { // API Key tidak valid atau tidak ditemukan (401) echo "Authentication failed: " . $e->getMessage(); } catch (PaymentRequiredException $e) { // Paket berlangganan tidak mencukupi atau API Key sudah expired (402) echo "Payment required: " . $e->getMessage(); } catch (RateLimitException $e) { // Melebihi batas permintaan API (429) echo "Rate limit exceeded: " . $e->getMessage(); } catch (ApiException $e) { // Other API errors echo "API Error: " . $e->getMessage(); }
Laravel Integration
Service Provider (Optional)
Create a service provider to bind the client:
<?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use Invezgo\InvezgoClient; class InvezgoServiceProvider extends ServiceProvider { public function register() { $this->app->singleton(InvezgoClient::class, function ($app) { return new InvezgoClient(config('services.invezgo.api_key')); }); } }
Add to config/services.php:
'invezgo' => [ 'api_key' => env('INVEZGO_API_KEY'), ],
Add to .env:
INVEZGO_API_KEY=your-api-key-here
Usage in Laravel
use Invezgo\InvezgoClient; class StockController extends Controller { public function index(InvezgoClient $client) { $stocks = $client->analysis()->getStockList(); return view('stocks.index', compact('stocks')); } }
Available Services
- AnalysisService - Data Saham Indonesia (stocks, charts, financials, shareholders, etc.)
- WatchlistsService - Personal watchlist management
- JournalsService - Journal transaction management
- PortfoliosService - Portfolio management
- AiService - AI-powered analysis
- SearchService - Search stocks and users
- ProfileService - User profile operations
- MembershipService - Membership/subscription management
- PostsService - Posts and content
- RecommendationService - User recommendations
- TradesService - Realized trades management
- ScreenerService - Stock screener
- HealthService - API health checks
Response Format
All methods return arrays containing the API response data. The structure depends on the specific endpoint. Please refer to the Invezgo API Documentation for detailed response structures.
Rate Limiting
The API has rate limits based on your subscription package. When rate limits are exceeded, a RateLimitException is thrown. You should implement retry logic with exponential backoff.
Support
- Website: https://invezgo.com
- Email: admin@invezgo.com
- API Documentation: https://invezgo.com
- API Key Settings: https://invezgo.com/id/setting/api
License
MIT License. See LICENSE file for details.
Changelog
1.0.0
- Initial release
- Full API coverage
- All services implemented
- Exception handling
- Laravel integration support
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-01