diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b8673c1
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/.idea
+/vendor/
diff --git a/.idea/deployment.xml b/.idea/deployment.xml
deleted file mode 100644
index 11c3719..0000000
--- a/.idea/deployment.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/easy-yelp.iml b/.idea/easy-yelp.iml
deleted file mode 100644
index c956989..0000000
--- a/.idea/easy-yelp.iml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index 146ab09..0000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index ba06252..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
deleted file mode 100644
index 30b4799..0000000
--- a/.idea/php.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 5b91372..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,389 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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/README.md b/README.md
index 9aa6da2..5f5ec47 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ 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');
+$yelp = new EasyYelp\Yelp('YOUR_API_TOKEN');
$businesses = $yelp->businessSearch([
'location' => 'Los Angeles, CA',
'price' => '1,2,3',
@@ -89,6 +89,9 @@ $alias = 'blahblah';
$request = [];
$yelp->categoryDetails($alias, $request)->getArray();
```
+### Examples
+You can check tests directory files to see some examples for using API methods.
+
### Errors
To check if you received an error from Yelp API or not you can use following functions.
```php
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..ca59597
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,20 @@
+{
+ "name": "hoseinrafiei/easy-yelp",
+ "description": "A light-weight PHP Client for Yelp Fusion API",
+ "type": "library",
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Hosein Rafiei",
+ "email": "hoseinrafiei@gmail.com"
+ }
+ ],
+ "require": {
+ "php": ">=7.0.0"
+ },
+ "autoload": {
+ "psr-0": {
+ "HoseinRafiei": "src/"
+ }
+ }
+}
diff --git a/src/yelp.php b/src/EasyYelp/yelp.php
similarity index 81%
rename from src/yelp.php
rename to src/EasyYelp/yelp.php
index a5bb070..1d67790 100644
--- a/src/yelp.php
+++ b/src/EasyYelp/yelp.php
@@ -1,9 +1,11 @@
- * @class Yelp
+ * @author Hosein Rafiei
+ * @class EasyYelp
* @version 1.0.0
*/
class Yelp
@@ -27,7 +29,7 @@ class Yelp
private $token;
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param string $token
*/
public function __construct(string $token)
@@ -36,7 +38,7 @@ public function __construct(string $token)
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param array $args
* @return Yelp
*/
@@ -46,7 +48,7 @@ public function businessSearch(array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param array $args
* @return Yelp
*/
@@ -56,7 +58,7 @@ public function businessPhoneSearch(array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param string $transactionType
* @param array $args
* @return Yelp
@@ -67,7 +69,7 @@ public function transactionSearch(string $transactionType = 'delivery', array $a
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param string $id
* @param array $args
* @return Yelp
@@ -78,7 +80,7 @@ public function businessDetails(string $id, array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param array $args
* @return Yelp
*/
@@ -88,7 +90,7 @@ public function businessMatch(array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param string $id
* @param array $args
* @return Yelp
@@ -99,7 +101,7 @@ public function businessReviews(string $id, array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param array $args
* @return Yelp
*/
@@ -109,7 +111,7 @@ public function autocomplete(array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param array $args
* @return Yelp
*/
@@ -119,7 +121,7 @@ public function events(array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param string $id
* @param array $args
* @return Yelp
@@ -130,7 +132,7 @@ public function eventDetails(string $id, array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param array $args
* @return Yelp
*/
@@ -140,7 +142,7 @@ public function featuredEvent(array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param array $args
* @return Yelp
*/
@@ -150,7 +152,7 @@ public function categories(array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param string $alias
* @param array $args
* @return Yelp
@@ -161,7 +163,7 @@ public function categoryDetails(string $alias, array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @return array
*/
public function getArray()
@@ -170,7 +172,7 @@ public function getArray()
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @return array
*/
public function getObject()
@@ -179,8 +181,8 @@ public function getObject()
}
/**
- * @author Hossein R.
- * @param array|stdClass $response
+ * @author Hosein Rafiei
+ * @param array|\stdClass $response
* @return boolean
*/
public function hasError($response = NULL)
@@ -194,8 +196,8 @@ public function hasError($response = NULL)
}
/**
- * @author Hossein R.
- * @param array|stdClass $response
+ * @author Hosein Rafiei
+ * @param array|\stdClass $response
* @return string
*/
public function getError($response = NULL)
@@ -212,7 +214,7 @@ public function getError($response = NULL)
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param string $route
* @param array $args
* @return Yelp
@@ -223,7 +225,7 @@ protected function _postRequest(string $route, array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param string $route
* @param array $args
* @return Yelp
@@ -234,7 +236,7 @@ protected function _getRequest(string $route, array $args = array())
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param string $route
* @param array $args
* @param string $method
@@ -283,7 +285,7 @@ protected function _call(string $route, array $args = array(), string $method =
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @param string $route
* @return string
*/
@@ -293,7 +295,7 @@ protected function _url(string $route)
}
/**
- * @author Hossein R.
+ * @author Hosein Rafiei
* @return string
*/
protected function _getTokenHeader()
diff --git a/tests/business-details.php b/tests/business-details.php
index 3e12c2b..5e3e0b6 100644
--- a/tests/business-details.php
+++ b/tests/business-details.php
@@ -1,12 +1,12 @@
categories()->getArray();
diff --git a/tests/get-category-details.php b/tests/get-category-details.php
index 11f3a07..054756c 100644
--- a/tests/get-category-details.php
+++ b/tests/get-category-details.php
@@ -1,12 +1,12 @@
categories()->getArray();
diff --git a/tests/get-event-details.php b/tests/get-event-details.php
index ca9ff15..cddae82 100644
--- a/tests/get-event-details.php
+++ b/tests/get-event-details.php
@@ -1,12 +1,12 @@
events()->getArray();
diff --git a/tests/get-featured-event.php b/tests/get-featured-event.php
index 3ef21f9..6109fb1 100644
--- a/tests/get-featured-event.php
+++ b/tests/get-featured-event.php
@@ -1,12 +1,12 @@