Skip to content

Codegyan-LLC/client

Repository files navigation

Codegyan PHP

GitHub Workflow Status (main) Total Downloads Latest Version PHP Version License


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:

Table of Contents

Get Started

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";
}

Usage

Before using the Pakage, you need to obtain an API key and client ID from Codegyan. Follow these steps to get your API credentials:

  1. 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.

  2. 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.

Compiler Resource

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";
}

Tools Resource

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";
}

Troubleshooting

If you encounter any issues or have any questions, please feel free to reach out to our support team at support@codegyan.com.

Testing

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.

Services

For more information about CodeGyan's services, please visit our website.

Codegyan PHP SDK is an open-sourced software licensed under the MIT license.