Download the PHP package shockmediabv/myshock-php-client without Composer
On this page you can find all versions of the php package shockmediabv/myshock-php-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shockmediabv/myshock-php-client
More information about shockmediabv/myshock-php-client
Files in shockmediabv/myshock-php-client
Package myshock-php-client
Short Description PHP client library for interacting with the My Shock Media API
License Apache-2.0
Homepage https://github.com/shockmediabv/myshock-php-client
Informations about the package myshock-php-client
My Shock Media PHP API Client (BETA)
Welcome to the My Shock Media PHP API Client! This project provides a PHP client library for interacting with the My Shock Media API. It's generated from the OpenRPC specification and allows you to perform requests on behalf of users to manage domains, retrieve server information, and more.
Note: This project is currently in BETA. We do not guarantee compatibility with future versions, and breaking changes may occur.
Installation
To install this library, it is recommended to use Composer. You can include the package
in your composer.json
file as follows:
Then, run the following command to install the package:
Alternatively, you can install the package directly using the command:
Basic usage
Here's a simple example to get you started with using the My Shock Media PHP API Client:
Explanation
- HTTP Client Setup:
- We start by creating a SimpleHttpClient, which is the core client used for sending requests to the API. This
client requires two parameters:
- API URL: The base URL of the My Shock Media API.
- Authorization Header: The Authorization header string, which typically includes the authentication scheme and the API key or credentials.
- Optionally, you can supply your own HTTP Client implementation, for example if you want to use cURL for HTTP requests.
- We start by creating a SimpleHttpClient, which is the core client used for sending requests to the API. This
client requires two parameters:
- Domain Client:
- We then create a DomainClient, which allows us to interact with the domain management API endpoints.
- The client library provides
***Client
objects for all API endpoints.
- Example call:
- In this example, we use the
listDomains
method to retrieve the first 10 domains owned by the user, sorted by name in ascending order.
- In this example, we use the
Authentication Schemes Supported
- ApiKey: The recommended scheme, which can be limited in scope and can be IP-restricted.
- Basic: Basic HTTP authentication using a Base64 encoded string of the username and password. ⚠ Warning: This method provides full access to the user account and is less secure. Use API tokens wherever possible.
Creating API keys
To create an API key:
- Log in to your My Shock Media account.
- Navigate to API Tokens and click on 'Create new token' under 'API tokens'.
- Alternatively, navigate to Create new token directly.
- Fill in the form to choose a name, expiry date and permissions for the token.
- Click on 'Create new token' to submit the form. Make sure to save the created token, because it is only shown once.
Documentation
Comprehensive documentation for the My Shock Media API and the PHP client library is available on the API Documentation page within your My Shock Media account (login required).
License
This project is licensed under the Apache-2.0 License. See the LICENSE file for details.
Support
If you encounter any issues or have questions, feel free to open a support ticket in My Shock Media or contact us via email at [email protected].