How amirsarhang/instagram-php-sdk works
This PHP library lets an application authenticate with Instagram and make Graph API requests through a PSR-18 HTTP client. The main workflow is to configure the SDK, create an Instagram client, then use OAuth to obtain or refresh a token, or use a resource/raw request with an existing token. Account lookup, comments, messaging, and webhook subscription are distinct API capabilities. The transport builds and sends requests and translates responses into arrays or exceptions. Resource wiring and transport behavior are supported by sampled source; account implementation details are represented only at the documented capability level.
Main entry points: Instagram.php Instagram facade · GraphClient.php Graph client · AbstractResource.php Resource base · OAuth.php OAuth
Components 15
SDK entry and config
- Instagram facade
src/Instagram.php - Config
src/Config.php - Environment
src/Environment.php
Login and tokens
- OAuth
src/Auth/OAuth.php
Graph API resources
- Account
src/Resources/Account.php - Comments
src/Resources/Comments.php - Messages
src/Resources/Messages.php - Webhooks
src/Resources/Webhooks.php - Resource base
src/Resources/AbstractResource.php
Transport and errors
- Graph client
src/Http/GraphClient.php - Graph errors
src/Exception/GraphException.php - Transport errors
src/Exception/TransportException.php
Other components
- Application
- Instagram APIs
- PSR-18 client
Connections 21
- Application → Instagram facade: creates and uses
- Instagram facade → Config: loads config
- Config → Environment: reads variables
- Instagram facade → OAuth: provides OAuth
- Instagram facade → Account: provides account
- Instagram facade → Comments: provides comments
- Instagram facade → Messages: provides messaging
- Instagram facade → Webhooks: provides webhooks
- Instagram facade → Graph client: dispatches raw calls
- Instagram facade → Graph client: creates transport
- OAuth → Config: uses credentials
- OAuth → Graph client: exchanges and queries
- Account → Resource base: inherits
- Comments → Resource base: inherits
- Messages → Resource base: inherits
- Webhooks → Resource base: inherits
- Resource base → Graph client: dispatches requests
- Graph client → PSR-18 client: sends requests
- PSR-18 client → Instagram APIs: HTTP exchange
- Graph client → Graph errors: raises API errors
- Graph client → Transport errors: raises transport errors