Download the PHP package sharpapi/php-core without Composer

On this page you can find all versions of the php package sharpapi/php-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-core

SharpAPI GitHub cover

SharpAPI.com PHP Core functionalities & communication

🚀 Automate workflows with AI-powered API

Leverage AI API to streamline workflows in E-Commerce, Marketing, Content Management, HR Tech, Travel, and more.

See more at SharpAPI.com Website »


Requirements

Installation

Note: This is the core library. Most users will install one of the specialized endpoint packages which already require sharpapi/php-core as a dependency.


Quota Method

The quota() method returns a SubscriptionInfo DTO with the following fields:

Field Type Description
timestamp Carbon Timestamp of the subscription check
on_trial bool Whether the account is on a trial period
trial_ends Carbon End date of the trial period
subscribed bool Whether the user is currently subscribed
current_subscription_start Carbon Start of the current subscription period
current_subscription_end Carbon End of the current subscription period
current_subscription_reset Carbon Quota reset timestamp
subscription_words_quota int Total word quota for the period
subscription_words_used int Words used in the current period
subscription_words_used_percentage float Percentage of word quota used
requests_per_minute int Maximum API requests allowed per minute

Two-Layer Rate Limiting Architecture

The SDK uses a two-layer approach to keep your requests within API limits:

Layer Type How it works
Native Throttling Proactive (client-side) Sliding window rate limiter blocks outgoing requests before they hit the server
429 Retry & Adaptive Polling Reactive (server-side) Catches HTTP 429 responses, retries with backoff, and slows polling when limits are low

The proactive layer prevents most 429 errors from ever occurring. The reactive layer acts as a safety net for edge cases (clock drift, concurrent processes, plan changes).


Native Throttling

Every SharpApiClient instance includes an in-memory sliding window rate limiter (SlidingWindowRateLimiter) that tracks request timestamps in a 60-second rolling window.

Before each API call, waitIfNeeded() checks the window. If capacity is available the request proceeds immediately; if not, the call sleeps until the oldest timestamp expires out of the window.

Configuration

Advanced Throttling Controls

You can access the underlying SlidingWindowRateLimiter instance directly for fine-grained control:

Cross-process state caching — save and restore the server-reported rate limit state (e.g. between HTTP requests in a web app):

Quick quota check — verify the server still reports available capacity before making a request:


Automatic 429 Retry & Adaptive Polling

If a request does hit the server rate limit, the SDK handles it automatically:

  1. Retry automatically — reads the Retry-After header, sleeps for the specified duration, and retries the request (up to 3 times by default).
  2. Slow down polling — during fetchResults(), when X-RateLimit-Remaining drops below the low threshold, polling intervals are automatically increased to avoid hitting the limit.

Inspecting Rate-Limit State

After any API call, you can check the current rate-limit values:

Note: getRateLimitLimit() and getRateLimitRemaining() return null before the first API call or after endpoints that don't return rate-limit headers (e.g. /ping, /quota).

Configuration

When rateLimitRemaining is at or below the threshold, polling intervals in fetchResults() are multiplied by an increasing factor (2x at threshold, growing as remaining approaches 0). This helps avoid 429 errors during long-running job polling.


Credits


License

The MIT License (MIT).


Social Media

🚀 For the latest news, tutorials, and case studies, don't forget to follow us on:


All versions of php-core with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.8.2
nesbot/carbon Version ^2.0|^3.0
ext-json Version *
ext-mbstring Version *
spatie/url Version ^2.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package sharpapi/php-core contains the following files

Loading the files please wait ...