Codegyan PHP SDK for interacting with the Codegyan API. If you or your business relies on this package, it's important to support the developers who have contributed their time and effort to create and maintain this valuable tool:
- Prathmesh Yelne : github.com/sponsors/prathmeshyelne
Requires PHP 8.1+
First, install Codegyan via the Composer package manager:
composer require codegyan/client
Then, interact with Codegyan's API:
use Codegyan\Client;
// Your API key and client ID
$apiKey = '';
$clientId = '';
// Create a Client instance
$client = new Client($apiKey, $clientId);
$domain = "codegyan.in"; // Domain Here
try {
$result = $client->toolsApiClient->domainAvailability($domain);
echo "$result\n";
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
Before using the Pakage, you need to obtain an API key and client ID from Codegyan. Follow these steps to get your API credentials:
-
Sign Up/Login: If you don't have an account, sign up for a Codegyan account. If you already have an account, log in to your dashboard.
-
Get Credentials: Once logged in, navigate to the Developer Console or API settings in your account dashboard. Here, you will find your API key and client ID. Copy these credentials and use them when initializing the Pakage in your code.
The Compiler resource allows you to compile code snippets. Here's an example of how to use it:
use Codegyan\Client;
// Your API key and client ID
$apiKey = '';
$clientId = '';
// Create a Client instance
$client = new Client($apiKey, $clientId);
$lang = "python3";
$code = "print('Hello World')";
try {
$result = $client->compilerApiClient->compile($lang, $code);
echo "$result\n";
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
The Tools resource provides various utility functions. Here's an example of how to use it:
use Codegyan\Client;
// Your API key and client ID
$apiKey = '';
$clientId = '';
// Create a Client instance
$client = new Client($apiKey, $clientId);
$domain = "example.com";
try {
$result = $client->toolsApiClient->domainAvailability($domain);
echo "$result\n";
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
}
If you encounter any issues or have any questions, please feel free to reach out to our support team at support@codegyan.com.
We highly recommend testing your integration with CodeGyan's PHP SDK to ensure its correctness and reliability. You can use PHPUnit or any other testing framework of your choice to write and execute tests for your application.
If you haven't already installed PHPUnit, you can do so by running:
composer require --dev phpunit/phpunit
Once PHPUnit is installed, you can run your tests using the following command:
vendor/bin/phpunit
This command will execute all tests located in the tests directory of your project.
Note : Make sure to write tests that cover various use cases and edge cases of your integration with the CodeGyan SDK to ensure robustness.
For more information about CodeGyan's services, please visit our website.
Codegyan PHP SDK is an open-sourced software licensed under the MIT license.