api-video / php-api-client
PHP client for api.video web services.
Installs: 49 476
Dependents: 0
Suggesters: 0
Security: 0
Stars: 40
Watchers: 2
Forks: 6
Open Issues: 1
Requires
- php: ^7.3 || ^8.0
- ext-json: *
- php-http/multipart-stream-builder: ^1.1
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
Requires (Dev)
- nyholm/psr7: ^1.4
- phpunit/phpunit: ^9
- symfony/http-client: ^5.2
- dev-main
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.1
- v1.4.0
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.0
- v1.0.0
- v0.0.8
- v0.0.7
- v0.0.6
- v0.0.4
- v0.0.3
- v0.0.2
- v0.0.1
- dev-ai-summary-updates
- dev-analytics-updates
- dev-add-summary-feature-docs
- dev-Update-parameter-description
- dev-add-transcript-feature
- dev-add-video-tags-endpoint
- dev-discarded-videos
- dev-sort-params-in-analytics
- dev-watch-data-docs
- dev-fix-readmes-doctave-2
- dev-api-rate-limiting-oas
- dev-update-video-status-endpoint-description
- dev-fix-php-tests-language
- dev-Update-get-live-streams-sortby-attribute
- dev-Update-language-param-description
- dev-caption-language-update
- dev-documentation-repo-standalone
- dev-bugfix/analytics-dimension-values
- dev-Add-clip-object-timecode-descriptions
- dev-Fix-indirect-URLs
- dev-update-player-logo-request-description
- dev-remove-raw-statistics
- dev-fix-code-samples-fields
- dev-include-client-doc-in-documentation
- dev-bugfix/update-list-all-video-objects-descriptions
- dev-fix/merged-release-notes
- dev-feat/live-restreaming
- dev-bugfix/light-analytics
- dev-temp/live-restreaming
- dev-feat/light-analytics
- dev-bugfix/example_generation
- dev-bugfix/badrequest_problems
- dev-feat/improve_doc
- dev-fix-api-video-case
- dev-feature/upload-by-video-id-and-upload-token
- dev-chore/remove_issue_templates
- dev-date-rage-required-in-analytics
- dev-feature/origin_sdk_header
- dev-change-from-specification
- dev-fix-publishedAt-type
- dev-fix-python-nullables
- dev-improve-documentation
- dev-fix-contributing-md
- dev-add-issue-templates
- dev-add-received-parts-in-status
- dev-bugfix/player_update_payload
- dev-watermark-and-clip
- dev-handle-null-and-missing-values
- dev-fix-tags-query-param
- dev-fix-deprecated-mark-on-linkactive
- dev-documentation-update-in-api-spec
- dev-minor-change-in-api-description
- dev-github-action-to-create-release
- dev-feature/swift-api
- dev-add-player-theme-name
- dev-update-description-documentation
- dev-fix-readme-links
- dev-remove-coc-add-contributing
- dev-bump-readmeio-action
- dev-bump-openapi-generator-version
- dev-add-changelogs
- dev-stream-uploads
- dev-fix-php-readme
- dev-fix-chunk-size-value-in-readme
- dev-add-examples
- dev-add-composer-installs-in-readme
- dev-fix-php-arrays
- dev-fix-python-get-status-error
- dev-add-starts-paragraph-in-readmes
- dev-temp-test
- dev-remove-publishedat-in-creation-payload
- dev-remove-unused-player-theme-options
- dev-update-documentation
- dev-php-update-ext-json-requirement
- dev-fancyweb-patch-1
- dev-tests-on-staging
- dev-update-readmeio-documentation
- dev-fix/deep-objects-params-in-query
- dev-fixes-and-ci
- dev-php-client
This package is auto-updated.
Last update: 2024-11-06 08:53:35 UTC
README
api.video PHP client
api.video is the video infrastructure for product builders. Lightning fast video APIs for integrating, scaling, and managing on-demand & low latency live streaming features in your app.
Table of contents
- Project description
- Getting started
- Documentation
- Have you gotten use from this API client?
- Contribution
Project description
api.video's PHP API client streamlines the coding process. Chunking files is handled for you, as is pagination and refreshing your tokens.
Getting started
Installation
composer require api-video/php-api-client
Initialization
Due to PHP PSR support, you must initialize the client with 3 to 5 arguments:
- Base URI, which can be either
https://sandbox.api.video
orhttps://ws.api.video
- Your API key, available on your account
- HTTP client
- (Request factory)
- (Stream factory)
Note : If the HTTP client also implements RequestFactoryInterface and StreamFactoryInterface, then it is not necessary to pass this object in 4th and 5th argument.
Symfony HTTP client example
The Symfony HTTP client has the triple advantage of playing the role of HTTP client, but also of request factory and stream factory. It is therefore sufficient to pass it as an argument 3 times.
If the HTTP client isn't yet in your project, you can add it with:
composer require symfony/http-client composer require nyholm/psr7
Code sample
Client initialization
<?php require __DIR__ . '/vendor/autoload.php'; $httpClient = new \Symfony\Component\HttpClient\Psr18Client(); $client = new \ApiVideo\Client\Client( 'https://sandbox.api.video', 'YOUR_API_KEY', $httpClient ); ?>
Create a video
$payload = (new VideoCreationPayload()) ->setTitle('Test video creation'); // the `$client` must already be initialized. $video = $client->videos()->create($payload);
Upload a video
$payload = (new VideoCreationPayload()) ->setTitle('Test video creation'); $video = $client->videos()->create($payload); // the `$client` must already be initialized. $client->videos()->upload( $video->getVideoId(), new SplFileObject(__DIR__.'/../earth.mp4') );
Documentation
API Endpoints
AnalyticsApi
CaptionsApi
ChaptersApi
LiveStreamsApi
PlayerThemesApi
SummariesApi
TagsApi
UploadTokensApi
VideosApi
WatermarksApi
WebhooksApi
Models
- AccessToken
- AdditionalBadRequestErrors
- AnalyticsAggregatedMetricsResponse
- AnalyticsAggregatedMetricsResponseContext
- AnalyticsAggregatedMetricsResponseContextTimeframe
- AnalyticsData
- AnalyticsMetricsBreakdownResponse
- AnalyticsMetricsBreakdownResponseContext
- AnalyticsMetricsBreakdownResponseData
- AnalyticsMetricsOverTimeResponse
- AnalyticsMetricsOverTimeResponseContext
- AnalyticsMetricsOverTimeResponseData
- AnalyticsPlays400Error
- AnalyticsPlaysResponse
- AuthenticatePayload
- BadRequest
- BytesRange
- Caption
- CaptionsListResponse
- CaptionsUpdatePayload
- Chapter
- ChaptersListResponse
- ConflictError
- DiscardedVideoUpdatePayload
- FilterBy
- FilterBy1
- FilterBy2
- Link
- ListTagsResponse
- ListTagsResponseData
- LiveStream
- LiveStreamAssets
- LiveStreamCreationPayload
- LiveStreamListResponse
- LiveStreamUpdatePayload
- Metadata
- Model403ErrorSchema
- NotFound
- Pagination
- PaginationLink
- PlayerSessionEvent
- PlayerTheme
- PlayerThemeAssets
- PlayerThemeCreationPayload
- PlayerThemeUpdatePayload
- PlayerThemesListResponse
- Quality
- RefreshTokenPayload
- RestreamsRequestObject
- RestreamsResponseObject
- SummariesListResponse
- Summary
- SummaryCreationPayload
- SummarySource
- SummaryUpdatePayload
- TokenCreationPayload
- TokenListResponse
- TooManyRequests
- UnrecognizedRequestUrl
- UploadToken
- Video
- VideoAssets
- VideoClip
- VideoCreationPayload
- VideoSource
- VideoSourceLiveStream
- VideoSourceLiveStreamLink
- VideoStatus
- VideoStatusEncoding
- VideoStatusEncodingMetadata
- VideoStatusIngest
- VideoStatusIngestReceivedParts
- VideoThumbnailPickPayload
- VideoUpdatePayload
- VideoWatermark
- VideosListResponse
- Watermark
- WatermarksListResponse
- Webhook
- WebhooksCreationPayload
- WebhooksListResponse
Authentication
Some endpoints don't require authentication. These one can be called with a Client instantiated with a null
API key:
<?php require __DIR__ . '/vendor/autoload.php'; $httpClient = new \Symfony\Component\HttpClient\Psr18Client(); $client = new \ApiVideo\Client\Client( 'https://sandbox.api.video', null, $httpClient ); ?>
Chunks
The video is automatically split into 50 Mb chunks.
To modify the size of the chunks, fill in the last argument $contentRange
as follows:
bytes 0-{size}/0
where{size}
is the size of the chunk.
For example : bytes 0-500000/0
for 500 Kb chunks.
The chunks size value must be between 5 Mb and 128mb.
Tests
In order to run the PhpUnit tests, it is necessary to enter two variables in the command line:
BASE_URI
(for example :https://sandbox.api.video
)API_KEY
These identifiers must belong to a real api.video account.
$ BASE_URI="" API_KEY="..." vendor/bin/phpunit
Have you gotten use from this API client?
Please take a moment to leave a star on the client ⭐
This helps other users to find the clients and also helps us understand which clients are most popular. Thank you!
Contribution
Since this API client is generated from an OpenAPI description, we cannot accept pull requests made directly to the repository. If you want to contribute, you can open a pull request on the repository of our client generator. Otherwise, you can also simply open an issue detailing your need on this repository.