PHPackages                             nahid/php-stack-api - 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. nahid/php-stack-api

ActiveLibrary[API Development](/categories/api)

nahid/php-stack-api
===================

Its a PHP SDK for StackExchange API version 2.2

v1.1.0(9y ago)41.4kCreative CommonPHP

Since Jul 14Pushed 9y ago1 watchersCompare

[ Source](https://github.com/nahid/php-stack-api)[ Packagist](https://packagist.org/packages/nahid/php-stack-api)[ RSS](/packages/nahid-php-stack-api/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (5)Dependencies (3)Versions (6)Used By (0)

php-stack-api
=============

[](#php-stack-api)

php-stack-api is a php SDK for StackExchange api version 2.2. Now you can easily access and hanlde all of StackApps Apis. Lets enjoy :)

Requirements
------------

[](#requirements)

- CURL
- PHP 5.5.9 +

Installation
------------

[](#installation)

To install this package with your project, just run this command in your terminal from project root.

```
composer require nahid/php-stack-api
```

Configurations
--------------

[](#configurations)

After installation complete successfully, you have to configure it correctly. This package is also **Laravel** compatible.

### Laravel

[](#laravel)

Open `config/app.php` and add this line end of the providers array

```
Nahid\StackApis\StackApiServiceProvider::class,

```

and then run this command in your terminal to publish config file

```
php artisan vendor: publish --provider="Nahid\StackApis\StackApiServiceProvider"

```

When you run this command `stackapi.php` config file will be copy `config` directory of your project. Now open `app/stackapi.php` and file the credentials with your StackApps application.

```
return [
    'client_id' => 1234,
    'client_secret' => 'application-client-secret',
    'key' => 'application-key-value',
    'redirect_uri' => 'http://example.com/redirect-uri',
];
```

### Pure PHP Project

[](#pure-php-project)

There are no special configuration for pure PHP project. You have to pass configuration data when the class is instantiated.

```
require 'vendor/autoload.php';

use Nahid\StackApis\StackApi;

$config = [
    'client_id' => 1234,
    'client_secret' => 'application-client-secret',
    'key' => 'application-key-value',
    'redirect_uri' => 'http://example.com/redirect-uri',
];
$stackApi = new StackApi($config);
```

Usage
-----

[](#usage)

Its has a lots of functionalities. When all of these are configured, you just use it like what you what.

At first you need to authenticate an user with your project. So make a authentication link.

```
