diff --git a/.idea/deployment.xml b/.idea/deployment.xml
new file mode 100644
index 0000000..11c3719
--- /dev/null
+++ b/.idea/deployment.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/easy-yelp.iml b/.idea/easy-yelp.iml
new file mode 100644
index 0000000..c956989
--- /dev/null
+++ b/.idea/easy-yelp.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..146ab09
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..ba06252
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
new file mode 100644
index 0000000..30b4799
--- /dev/null
+++ b/.idea/php.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..5b91372
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,389 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id
+ int
+
+
+
+
+
+
+
+
+ true
+ DEFINITION_ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bitwise operation issuesJavaScript
+
+
+ Code SmellPHP
+
+
+ Code style issuesJavaScript
+
+
+ Flow type checkerJavaScript
+
+
+ GeneralJavaScript
+
+
+ HTML
+
+
+ Internationalization issues
+
+
+ JavaScript
+
+
+ Node.jsJavaScript
+
+
+ PHP
+
+
+ PHPDocPHP
+
+
+ Potentially confusing code constructsJavaScript
+
+
+ Probable bugsJavaScript
+
+
+ Probable bugsPHP
+
+
+ SQL
+
+
+ Spelling
+
+
+ Type compatibilityPHP
+
+
+ TypeScript
+
+
+ UndefinedPHP
+
+
+ XML
+
+
+ XPath
+
+
+
+
+ SpellCheckingInspection
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1546515739968
+
+
+ 1546515739968
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..e7ce99d
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Hossein Rafiei
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..9aa6da2
--- /dev/null
+++ b/README.md
@@ -0,0 +1,102 @@
+# Easy Yelp API Integration
+
+**Easy Yelp** is a single file PHP client for [Yelp API](https://www.yelp.com/developers/documentation/v3/get_started).
+
+### Installation
+You can simply download the file and include it in your project.
+
+### Usage
+Include it in your project and create an instance.
+
+```php
+require 'yelp.php';
+```
+
+If you're using composer or autoloader then you don't need to include it manually. You just need to configure your autoloader tool.
+
+```php
+$yelp = new Yelp('YOUR_TOKEN');
+$businesses = $yelp->businessSearch([
+ 'location' => 'Los Angeles, CA',
+ 'price' => '1,2,3',
+ 'sort_by' => 'distance',
+ 'limit' => '30',
+])->getArray();
+```
+
+### Methods
+#### [Business Search](https://www.yelp.com/developers/documentation/v3/business_search)
+```php
+$request = [];
+$yelp->businessSearch($request)->getArray();
+```
+#### [Phone Search](https://www.yelp.com/developers/documentation/v3/business_search_phone)
+```php
+$request = [];
+$yelp->businessPhoneSearch($request)->getArray();
+```
+#### [Transaction Search](https://www.yelp.com/developers/documentation/v3/transaction_search)
+```php
+$request = [];
+$yelp->transactionSearch('delivery', $request)->getArray();
+```
+#### [Business Details](https://www.yelp.com/developers/documentation/v3/business)
+```php
+$businessId = 'blahblah';
+$request = [];
+$yelp->businessDetails($businessId, $request)->getArray();
+```
+#### [Business Match](https://www.yelp.com/developers/documentation/v3/business_match)
+```php
+$request = [];
+$yelp->businessMatch($request)->getArray();
+```
+#### [Business Reviews](https://www.yelp.com/developers/documentation/v3/business_reviews)
+```php
+$businessId = 'blahblah';
+$request = [];
+$yelp->businessReviews($businessId, $request)->getArray();
+```
+#### [Autocomplete](https://www.yelp.com/developers/documentation/v3/autocomplete)
+```php
+$request = [];
+$yelp->autocomplete($request)->getArray();
+```
+#### [Event Lookup](https://www.yelp.com/developers/documentation/v3/event)
+```php
+$eventId = 'blahblah';
+$request = [];
+$yelp->eventDetails($eventId, $request)->getArray();
+```
+#### [Event Search](https://www.yelp.com/developers/documentation/v3/event_search)
+```php
+$request = [];
+$yelp->events($request)->getArray();
+```
+#### [Featured Event](https://www.yelp.com/developers/documentation/v3/featured_event)
+```php
+$request = [];
+$yelp->featuredEvent($request)->getArray();
+```
+#### [All Categories](https://www.yelp.com/developers/documentation/v3/all_categories)
+```php
+$request = [];
+$yelp->categories($request)->getArray();
+```
+#### [Category Details](https://www.yelp.com/developers/documentation/v3/category)
+```php
+$alias = 'blahblah';
+$request = [];
+$yelp->categoryDetails($alias, $request)->getArray();
+```
+### Errors
+To check if you received an error from Yelp API or not you can use following functions.
+```php
+$businesses = $yelp->businessSearch($request)->getArray();
+if($yelp->hasError()) // We have an error
+{
+ echo $yelp->getError(); // Print the error message
+}
+```
+### License
+This software released under **MIT License**.
\ No newline at end of file
diff --git a/src/yelp.php b/src/yelp.php
new file mode 100644
index 0000000..a5bb070
--- /dev/null
+++ b/src/yelp.php
@@ -0,0 +1,303 @@
+
+ * @class Yelp
+ * @version 1.0.0
+ */
+class Yelp
+{
+ /**
+ * API Endpoint
+ * @var string
+ */
+ private $endpoint = 'https://api.yelp.com/v3';
+
+ /**
+ * JSON Results
+ * @var string
+ */
+ private $results;
+
+ /**
+ * API Token
+ * @var string
+ */
+ private $token;
+
+ /**
+ * @author Hossein R.
+ * @param string $token
+ */
+ public function __construct(string $token)
+ {
+ $this->token = $token;
+ }
+
+ /**
+ * @author Hossein R.
+ * @param array $args
+ * @return Yelp
+ */
+ public function businessSearch(array $args = array())
+ {
+ return $this->_getRequest('businesses/search', $args);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param array $args
+ * @return Yelp
+ */
+ public function businessPhoneSearch(array $args = array())
+ {
+ return $this->_getRequest('businesses/search/phone', $args);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param string $transactionType
+ * @param array $args
+ * @return Yelp
+ */
+ public function transactionSearch(string $transactionType = 'delivery', array $args = array())
+ {
+ return $this->_getRequest('transactions/'.$transactionType.'/search', $args);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param string $id
+ * @param array $args
+ * @return Yelp
+ */
+ public function businessDetails(string $id, array $args = array())
+ {
+ return $this->_getRequest('businesses/'.$id, $args);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param array $args
+ * @return Yelp
+ */
+ public function businessMatch(array $args = array())
+ {
+ return $this->_getRequest('businesses/matches', $args);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param string $id
+ * @param array $args
+ * @return Yelp
+ */
+ public function businessReviews(string $id, array $args = array())
+ {
+ return $this->_getRequest('businesses/'.$id.'/reviews', $args);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param array $args
+ * @return Yelp
+ */
+ public function autocomplete(array $args = array())
+ {
+ return $this->_getRequest('autocomplete', $args);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param array $args
+ * @return Yelp
+ */
+ public function events(array $args = array())
+ {
+ return $this->_getRequest('events', $args);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param string $id
+ * @param array $args
+ * @return Yelp
+ */
+ public function eventDetails(string $id, array $args = array())
+ {
+ return $this->_getRequest('events/'.$id, $args);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param array $args
+ * @return Yelp
+ */
+ public function featuredEvent(array $args = array())
+ {
+ return $this->_getRequest('events/featured', $args);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param array $args
+ * @return Yelp
+ */
+ public function categories(array $args = array())
+ {
+ return $this->_getRequest('categories', $args);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param string $alias
+ * @param array $args
+ * @return Yelp
+ */
+ public function categoryDetails(string $alias, array $args = array())
+ {
+ return $this->_getRequest('categories/'.$alias, $args);
+ }
+
+ /**
+ * @author Hossein R.
+ * @return array
+ */
+ public function getArray()
+ {
+ return json_decode($this->results, true);
+ }
+
+ /**
+ * @author Hossein R.
+ * @return array
+ */
+ public function getObject()
+ {
+ return json_decode($this->results);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param array|stdClass $response
+ * @return boolean
+ */
+ public function hasError($response = NULL)
+ {
+ // Get Current Response
+ if(is_null($response)) $response = $this->getObject();
+
+ // Return Error Status
+ if(is_array($response)) return isset($response['error']);
+ else return isset($response->error);
+ }
+
+ /**
+ * @author Hossein R.
+ * @param array|stdClass $response
+ * @return string
+ */
+ public function getError($response = NULL)
+ {
+ // Get Current Response
+ if(is_null($response)) $response = $this->getObject();
+
+ // Check to See if we have Error
+ if(!$this->hasError($response)) return NULL;
+
+ // Return Error Description
+ if(is_array($response)) return $response['error']['description'];
+ else return $response->error->description;
+ }
+
+ /**
+ * @author Hossein R.
+ * @param string $route
+ * @param array $args
+ * @return Yelp
+ */
+ protected function _postRequest(string $route, array $args = array())
+ {
+ return $this->_call($route, $args, 'POST');
+ }
+
+ /**
+ * @author Hossein R.
+ * @param string $route
+ * @param array $args
+ * @return Yelp
+ */
+ protected function _getRequest(string $route, array $args = array())
+ {
+ return $this->_call($route, $args, 'GET');
+ }
+
+ /**
+ * @author Hossein R.
+ * @param string $route
+ * @param array $args
+ * @param string $method
+ * @return Yelp
+ */
+ protected function _call(string $route, array $args = array(), string $method = 'POST')
+ {
+ // API URL to Call
+ $url = $this->_url($route);
+
+ // Init the CURL
+ $curl = curl_init();
+
+ // Request Method
+ if($method == 'POST')
+ {
+ curl_setopt($curl, CURLOPT_POST, 1);
+
+ // Request Payload
+ if(is_array($args) and count($args)) curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($args));
+ }
+ else
+ {
+ // Request Payload
+ if(is_array($args) and count($args)) $url = sprintf("%s?%s", $url, http_build_query($args));
+ }
+
+ // Set CURL Parameters
+ curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+
+ // Generate the Request Headers
+ $headers = array('Content-Type: application/json', $this->_getTokenHeader());
+
+ // Set Request Headers
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
+
+ // Execute the CURL
+ $this->results = curl_exec($curl);
+
+ // Close the CURL
+ curl_close($curl);
+
+ // Return the Results
+ return $this;
+ }
+
+ /**
+ * @author Hossein R.
+ * @param string $route
+ * @return string
+ */
+ protected function _url(string $route)
+ {
+ return rtrim($this->endpoint.'/'.$route, '/');
+ }
+
+ /**
+ * @author Hossein R.
+ * @return string
+ */
+ protected function _getTokenHeader()
+ {
+ return 'Authorization: Bearer '.$this->token;
+ }
+}
\ No newline at end of file
diff --git a/tests/business-details.php b/tests/business-details.php
new file mode 100644
index 0000000..3e12c2b
--- /dev/null
+++ b/tests/business-details.php
@@ -0,0 +1,17 @@
+businessDetails($businessId)->getArray();
+
+/**
+ * Do something with $business
+ */
\ No newline at end of file
diff --git a/tests/business-reviews.php b/tests/business-reviews.php
new file mode 100644
index 0000000..4d149d1
--- /dev/null
+++ b/tests/business-reviews.php
@@ -0,0 +1,17 @@
+businessReviews($businessId)->getArray();
+
+/**
+ * Do something with $business['reviews']
+ */
\ No newline at end of file
diff --git a/tests/business-search.php b/tests/business-search.php
new file mode 100644
index 0000000..9fae48c
--- /dev/null
+++ b/tests/business-search.php
@@ -0,0 +1,23 @@
+ 'Los Angeles, CA',
+ 'price' => '1,2,3',
+ 'sort_by' => 'distance',
+ 'limit' => '30',
+];
+
+$response = $yelp->businessSearch($request)->getArray();
+
+/**
+ * Do something with $response['businesses']
+ */
\ No newline at end of file
diff --git a/tests/get-categories.php b/tests/get-categories.php
new file mode 100644
index 0000000..14c75c1
--- /dev/null
+++ b/tests/get-categories.php
@@ -0,0 +1,16 @@
+categories()->getArray();
+
+/**
+ * Do something with $response['categories']
+ */
\ No newline at end of file
diff --git a/tests/get-category-details.php b/tests/get-category-details.php
new file mode 100644
index 0000000..11f3a07
--- /dev/null
+++ b/tests/get-category-details.php
@@ -0,0 +1,23 @@
+categories()->getArray();
+
+// Loop Through Categories
+foreach($response['categories'] as $c)
+{
+ // Get Category Details
+ $category = $yelp->categoryDetails($c['alias'])->getObject();
+
+ /**
+ * Do something with $category
+ */
+}
\ No newline at end of file
diff --git a/tests/get-event-details.php b/tests/get-event-details.php
new file mode 100644
index 0000000..ca9ff15
--- /dev/null
+++ b/tests/get-event-details.php
@@ -0,0 +1,17 @@
+eventDetails($eventId)->getObject();
+
+/**
+ * Do something with $event
+ */
\ No newline at end of file
diff --git a/tests/get-events.php b/tests/get-events.php
new file mode 100644
index 0000000..a6be5cd
--- /dev/null
+++ b/tests/get-events.php
@@ -0,0 +1,16 @@
+events()->getArray();
+
+/**
+ * Do something with $response['events']
+ */
\ No newline at end of file
diff --git a/tests/get-featured-event.php b/tests/get-featured-event.php
new file mode 100644
index 0000000..3ef21f9
--- /dev/null
+++ b/tests/get-featured-event.php
@@ -0,0 +1,20 @@
+ 'Los Angeles, CA',
+];
+
+$event = $yelp->featuredEvent($request)->getArray();
+
+/**
+ * Do something with $event
+ */
\ No newline at end of file