nahid / envato-php by nahid

Envato PHP is a PHP client for envato API
1,052
30
4
Package Data
Maintainer Username: nahid
Maintainer Contact: nahid.dns@gmail.com (Nahid Bin Azhar)
Package Create Date: 2016-12-20
Package Last Update: 2019-12-28
Language: PHP
License: CC(1.0)
Last Refreshed: 2024-11-22 03:11:08
Package Statistics
Total Downloads: 1,052
Monthly Downloads: 3
Daily Downloads: 1
Total Stars: 30
Total Watchers: 4
Total Forks: 13
Total Open Issues: 2

Envato PHP

Envato-PHP is a PHP client for Envato API. You can easily integrate it with your all kind of PHP based projects. This package is also compatible with Laravel 5.

Installation

To install this package run this command in you terminal from project root

composer require nahid/envato-php

For Laravel

Goto config/app.php and add this service provider in providers section

Nahid\EnvatoPHP\EnvatoServiceProvider::class,

and add this facade in facades section

'Envato' => Nahid\EnvatoPHP\Facades\Envato::class,

Run this command in your terminal

php artisan vendor:publish --provider="Nahid\EnvatoPHP\EnvatoServiceProvider"

after publishing your config file then open config/envato.php and add your envato app credentials.

return [
    "client_id"     => 'envato_app_client_id',

    'client_secret' => 'envato_app_client_secret',

    "redirect_uri"  =>  'redirect_uri',
    
     'app_name'      => 'nahid-envato-app',
];

Thats it.

Usages

use Nahid\EnvatoPHP\Envato;

$config = [
            "client_id"     => 'envato_app_client_id',
        
            'client_secret' => 'envato_app_client_secret',
        
            "redirect_uri"  =>  'redirect_uri',
            
             'app_name'      => 'nahid-envato-app',
        ];
        
 
 $envato = new Envato($config);
 
 $user = $envato->me()->accounts();
 
 var_dump($user->data);

But first you have to authenticate envato app. to get authenticate URL just use $envato->getAuthUrl().

For Laravel Usage

use Nahid\EnvatoPHP\Facades\Envato;

$user = Envato::me()->accounts();
dd($user->data);
// For envato purchase code verify  

use Nahid\EnvatoPHP\Facades\Envato;

$purchaseCode = 'purchase_code_here';
$purchaseVerify = Envato::me()->sale($purchaseCode);
if($purchaseVerify->getStatusCode() == 200) {
   dd($purchaseVerify->data);
} else {
   dd("Invalid Purchase Code");
}