PHP – Behance API tutorial with example and demo

PHP – Behance API tutorial with example and demo

In this post we will give you information about PHP – Behance API tutorial with example and demo. Hear we will give you detail about PHP – Behance API tutorial with example and demoAnd how to use it also give you demo for it if it is necessary.

Today, i am going to share with you how to use behance api in php project. In this article i will explain how to get projects from behance website using their api in your php website or any framework application like laravel, yii2, codeigniter etc.

Behance is a networking website and it is very popular website. Behance through you can self promotion like you can make your portfolio and projects in details with title, description, category, images etc. Behance most of the famous for self-promotion.

So, today we will learn how to use behance api in php, If you don’t know more about how to use api then not big issue, i will explain from scratch and give you very simple example to getting projects from username of behance. So you have to just follow three steps in this example as listed bellow:

1.Download API Files

2.Create API Key

3.Create index.php File

So, you have to just follow this three steps and you will get layout as listed bellow, and you can also check demo and download full script of source code from bellow:

Preview:

Step 1: Download API Files

In first step we have to download Behance Network API library from GitHub, So first let’s download from here :
Click Here to download PHP Behance API
After download extract it to your root folder and rename it to “api”.

Step 2: Create API Key

In second step you have to simple open bellow link and register your app on behance developer account they will provide app key and you can use it on your bellow example:

Register App From Here

Also see:Laravel Mailchimp api integration from scratch with example

Step 3: Create index.php File

Ok in the last step, we have to make index.php file on root directory and you have to add you “app key” on $apiKey variable. So let’s create index.php file and put bellow code on that file:

index.php

<?php


require_once( 'api/src/Client.php' );


$apiKey = "your api key paste here";

$apiUsername = $_GET['username'];


$client = new BehanceClient($apiKey);


if(!empty($apiUsername)){

$data = $client->getUserProjects($apiUsername);

}else{

$data = [];

}


?>


<!DOCTYPE html>

<html>

<head>

<title>PHP - Behance API</title>

<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

</head>

<body>


<div >

<h1>PHP - Behance API</h1>


<form method="GET">

<div >

<input type="text" name="username" placeholder="Search Behance Username">

<span >

<button type="submit">Submit</button>

</span>

</div><!-- /input-group -->

</form>

<br/>


<table >

<tr>

<th>Project Id</th>

<th>Project Name</th>

<th>Project Image</th>

</tr>

<?php if(!empty($data)){ ?>

<?php foreach($data as $k => $value){ ?>

<tr>

<td><?php echo $value->id; ?></td>

<td><?php echo $value->name; ?></td>

<td>

<?php

if(!empty($value->covers->original)){

echo "<a href='".$value->covers->original."' target='_blank'>View Image</a>";

}

?>

</td>

</tr>

<?php } ?>

<?php }else{ ?>

<tr>

<td colspan="5">There are no data.</td>

</tr>

<?php } ?>

</table>

</div>


</body>

</html>

Ok, now we are ready to run this example, so just run bellow command on root folder for run your project.

php -S localhost:8000

Now you can open bellow url on your browser:

Also see:PHP – multiple file uploading dropzone js example

http://localhost:8000

I hope it can help you…

Hope this code and post will helped you for implement PHP – Behance API tutorial with example and demo. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  33  =  43

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US