Download the PHP package danielgnh/polymarket-laravel without Composer
On this page you can find all versions of the php package danielgnh/polymarket-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download danielgnh/polymarket-laravel
More information about danielgnh/polymarket-laravel
Files in danielgnh/polymarket-laravel
Package polymarket-laravel
Short Description Laravel adapter for the Polymarket PHP - Integrate prediction markets into your Laravel applications
License MIT
Homepage https://github.com/polymarket-php/polymarket-laravel
Informations about the package polymarket-laravel
Polymarket Laravel
This is a Laravel adapter for the Polymarket PHP SDK, providing easy ways to integrate polymarket in your Laravel application.
Requirements
- PHP 8.2 or higher
- Laravel 10.x, 11.x, or 12.x
Installation
You can install the package via Composer:
Quick Setup
Run the install command for guided setup:
This will:
- Publish the configuration file
- Display instructions for adding credentials to your
.envfile
Manual Setup
Alternatively, you can publish the configuration file manually:
Configuration
Add your Polymarket credentials to your .env file:
Configuration Options
All configuration options can be customized in config/polymarket.php:
| Option | Environment Variable | Default | Description |
|---|---|---|---|
api_key |
POLYMARKET_API_KEY |
null |
API key for authenticated requests (optional for read-only) |
private_key |
POLYMARKET_PRIVATE_KEY |
null |
Private key for trading operations |
chain_id |
POLYMARKET_CHAIN_ID |
137 |
Blockchain network (137 = Polygon mainnet) |
gamma_base_url |
POLYMARKET_GAMMA_BASE_URL |
https://gamma-api.polymarket.com |
Gamma API base URL |
clob_base_url |
POLYMARKET_CLOB_BASE_URL |
https://clob.polymarket.com |
CLOB API base URL |
bridge_base_url |
POLYMARKET_BRIDGE_BASE_URL |
https://bridge-api.polymarket.com |
Bridge API base URL |
timeout |
POLYMARKET_TIMEOUT |
30 |
Request timeout in seconds |
retries |
POLYMARKET_RETRIES |
3 |
Number of retry attempts |
verify_ssl |
POLYMARKET_VERIFY_SSL |
true |
Enable SSL certificate verification |
Usage
Using the Facade
The facade provides convenient static access to the Polymarket client:
Dependency Injection
Inject the client directly into your classes:
Trading Operations (CLOB API)
For trading operations, you need to configure both an API key and private key:
Bridge API (Cross-Chain Deposits)
The Bridge API enables deposits from multiple chains, automatically converting to USDC.e on Polygon:
Market Data Examples
Fetching All Markets
Searching Markets
Getting Market Details
Error Handling
The SDK throws specific exceptions for different error scenarios:
Testing
The package includes comprehensive tests:
Mocking in Your Tests
You can easily mock the Polymarket client in your tests:
Advanced Configuration
Custom Timeouts
For long-running operations, adjust the timeout:
Retry Configuration
Configure automatic retry behavior:
Local Development
Disable SSL verification for local testing (not recommended for production):
Custom API URLs
Use custom API endpoints (useful for testing):
Changelog
Please see CHANGELOG for more information on recent changes.
Contributing
Contributions are welcome! In case if you found any bug or have an idea just open an issue and create a Pull Request.
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
- Daniel Goncharov
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of polymarket-laravel with dependencies
polymarket-php/polymarket Version ^1.2
illuminate/contracts Version ^10.0|^11.0|^12.0
spatie/laravel-package-tools Version ^1.16