PHPackages                             vipinkhushu/hackerearth-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. vipinkhushu/hackerearth-sdk-php

ActiveLibrary[API Development](/categories/api)

vipinkhushu/hackerearth-sdk-php
===============================

A PHP SDK To Run And Compile Codes Using Hackerearth's API V3

12177[2 issues](https://github.com/vipinkhushu/Hackerearth-SDK-PHP/issues)PHP

Since Jan 25Pushed 9y ago2 watchersCompare

[ Source](https://github.com/vipinkhushu/Hackerearth-SDK-PHP)[ Packagist](https://packagist.org/packages/vipinkhushu/hackerearth-sdk-php)[ RSS](/packages/vipinkhushu-hackerearth-sdk-php/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Hackerearth-SDK-PHP
===================

[](#hackerearth-sdk-php)

A PHP SDK To Run And Compile Codes Using Hackerearth's API V3

This library helps you to compile and run your code with [HackerEarth API v3](https://www.hackerearth.com/docs/api/developers/code/v3/)

Using HackerEarth API you can compile and run your code using their [CodeTable](https://code.hackerEarth.com)

#### Prerequisite

[](#prerequisite)

You have to obtain your client secret key from [HackerEarth Here](http://www.hackerearth.com/api/register/) and voila you are done!

#### Install

[](#install)

> Currently You Can Simply Download A Zip Of This Repo And put this into you code require\_once **DIR**.'path\\to\\folder\\sdk\\index.php';

> To Use Via [Composer](http://www.getcomposer.com)

```
composer require vipinkhushu/hackerearth-sdk-php
require_once __DIR__.'\sdk\index.php';

```

#### Language Codes

[](#language-codes)

Kindly Use the below codes only to give language name C, CPP, CPP11, CLOJURE, CSHARP, JAVA, JAVASCRIPT, HASKELL, PERL, PHP, PYTHON, RUBY

#### Set Up

[](#set-up)

```
//Import the SDK
require_once __DIR__.'path\sdk\index.php';

//Setting up the Hackerearth API
$hackerearth = Array(
		'client_secret' => 'b1803e335e227a1320fc6dc3587a0d496e97d3e5', //(REQUIRED) Obtain this by registering your app at http://www.hackerearth.com/api/register/
        'time_limit' => '5',   //(OPTIONAL) Time Limit (MAX = 5 seconds )
        'memory_limit' => '262144'  //(OPTIONAL) Memory Limit (MAX = 262144 [256 MB])
	);

```

#### Compile Your code

[](#compile-your-code)

```
//compile your code
//Feeding Data Into Hackerearth API
$config = Array();
$config['time']='5';	 	//(OPTIONAL) Your time limit in integer and in unit seconds
$config['memory']='262144'; //(OPTIONAL) Your memory limit in integer and in unit kb
$config['source']='print("Hello! Vipin");';    	//(REQUIRED) Your source code for which you want to use hackerEarth api
$config['input']='';     	//(OPTIONAL) Input against which you have to test your source code
$config['language']='PYTHON';   	//(REQUIRED) Choose any one of them
						 	// C, CPP, CPP11, CLOJURE, CSHARP, JAVA, JAVASCRIPT, HASKELL, PERL, PHP, PYTHON, RUBY

//Sending request to the API to compile and run and record JSON responses
$responseOfCompile = compile($hackerearth,$config);

```

#### Run Your Code

[](#run-your-code)

```
//Run a source code against a input
//Feeding Data Into Hackerearth API
$config = Array();
$config['time']='5';	 	//(OPTIONAL) Your time limit in integer and in unit seconds
$config['memory']='262144'; //(OPTIONAL) Your memory limit in integer and in unit kb
$config['source']='print("Hello! Vipin");';    	//(REQUIRED) Your source code for which you want to use hackerEarth api
$config['input']='';     	//(OPTIONAL) Input against which you have to test your source code
$config['language']='PYTHON';   	//(REQUIRED) Choose any one of them
						 	// C, CPP, CPP11, CLOJURE, CSHARP, JAVA, JAVASCRIPT, HASKELL, PERL, PHP, PYTHON, RUBY
$responseOfRun = run($hackerearth,$config);

```

#### Compile Your File

[](#compile-your-file)

```
//compile your code  from a file
//Feeding Data Into Hackerearth API
$config = Array();
$config['time']='5';	 	//(OPTIONAL) Your time limit in integer and in unit seconds
$config['memory']='262144'; //(OPTIONAL) Your memory limit in integer and in unit kb
$config['file']='';			//(REQUIRED WHEN YOU ARE USING A SOURCE FILE) Give the complete address to the file
$config['input']='';     	//(OPTIONAL) Properly Formatted Input against which you have to test your source code
$config['language']='PYTHON';   //(REQUIRED) Choose any one of the below
						 	// C, CPP, CPP11, CLOJURE, CSHARP, JAVA, JAVASCRIPT, HASKELL, PERL, PHP, PYTHON, RUBY

//Sending request to the API to compile and run and record JSON responses
$response = compile_with_file($hackerearth,$config);

```

#### Run Your File

[](#run-your-file)

```
//Run a source code against a input   from a file
//Feeding Data Into Hackerearth API
//Feeding Data Into Hackerearth API
$config = Array();
$config['time']='5';	 	//(OPTIONAL) Your time limit in integer and in unit seconds
$config['memory']='262144'; //(OPTIONAL) Your memory limit in integer and in unit kb
$config['file']='';			//(REQUIRED WHEN YOU ARE USING A SOURCE FILE) Give the complete address to the file
$config['input']='';     	//(OPTIONAL) Properly Formatted Input against which you have to test your source code
$config['language']='PYTHON';   //(REQUIRED) Choose any one of the below
						 	// C, CPP, CPP11, CLOJURE, CSHARP, JAVA, JAVASCRIPT, HASKELL, PERL, PHP, PYTHON, RUBY

//Sending request to the API to compile and run and record JSON responses
$response = run_with_file($hackerearth,$config);

```

#### License

[](#license)

MIT

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/11455744?v=4)[Vipin Khushu](/maintainers/vipinkhushu)[@vipinkhushu](https://github.com/vipinkhushu)

---

Top Contributors

[![vipinkhushu](https://avatars.githubusercontent.com/u/11455744?v=4)](https://github.com/vipinkhushu "vipinkhushu (5 commits)")[![viru1404](https://avatars.githubusercontent.com/u/11455714?v=4)](https://github.com/viru1404 "viru1404 (3 commits)")

### Embed Badge

![Health badge](/badges/vipinkhushu-hackerearth-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/vipinkhushu-hackerearth-sdk-php/health.svg)](https://phpackages.com/packages/vipinkhushu-hackerearth-sdk-php)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
