File tree Expand file tree Collapse file tree 7 files changed +315
-204
lines changed Expand file tree Collapse file tree 7 files changed +315
-204
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " greip/api" ,
3
- "description" : " Greip, protects your business from fraud and abuse by deploying AI-powered modules into your system." ,
4
- "keywords" : [
5
- " api" ,
6
- " ip" ,
7
- " location" ,
8
- " fraud" ,
9
- " abuse" ,
10
- " profanity" ,
11
- " geoip"
12
- ],
13
- "license" : " MIT" ,
14
- "authors" : [
15
- {
16
- "name" : " Greip" ,
17
- "email" : " info@greip.io" ,
18
- "homepage" : " https://greip.io/" ,
19
- "role" : " Developer"
20
- }
21
- ],
22
- "type" : " library" ,
23
- "require" : {
24
- "php" : " >=7.4"
25
- },
26
- "autoload" : {
27
- "psr-4" : {
28
- "Greip\\ API\\ " : " src/"
29
- }
30
- },
31
- "minimum-stability" : " stable"
32
- }
2
+ "name" : " greip/api" ,
3
+ "description" : " Greip, protects your business from fraud and abuse by deploying AI-powered modules into your system." ,
4
+ "keywords" : [
5
+ " api" ,
6
+ " ip" ,
7
+ " location" ,
8
+ " fraud" ,
9
+ " abuse" ,
10
+ " profanity" ,
11
+ " geoip" ,
12
+ " bin lookup" ,
13
+ " email verification" ,
14
+ " phone verification" ,
15
+ " ip reputation" ,
16
+ " ip intelligence" ,
17
+ " iban validation"
18
+ ],
19
+ "license" : " MIT" ,
20
+ "authors" : [
21
+ {
22
+ "name" : " Greip" ,
23
+ "email" : " info@greip.io" ,
24
+ "homepage" : " https://greip.io/" ,
25
+ "role" : " Developer"
26
+ }
27
+ ],
28
+ "type" : " library" ,
29
+ "require" : {
30
+ "php" : " >=7.4"
31
+ },
32
+ "autoload" : {
33
+ "psr-4" : {
34
+ "Greip\\ API\\ " : " src/"
35
+ }
36
+ },
37
+ "minimum-stability" : " stable"
38
+ }
Original file line number Diff line number Diff line change 4
4
5
5
class Config
6
6
{
7
- public static $ APIKey = "" ;
7
+ public static $ APIKey = null ;
8
8
9
9
/**
10
- * setKey method
10
+ * Set the API Key
11
11
*
12
- * @param string $key Pass you API Key as a string here. You can also store it in a .env file and pass a variable that returns the API Key as a string.
12
+ * @param string $key The API Key
13
13
*
14
14
* @return bool
15
15
*/
16
- public function setKey ($ key ): bool
16
+ public function setToken ($ key ): bool
17
17
{
18
18
if (!empty ($ key )) {
19
19
self ::$ APIKey = $ key ;
@@ -23,7 +23,24 @@ public function setKey($key): bool
23
23
}
24
24
}
25
25
26
- public function getKey (): string
26
+ /**
27
+ * Set the API Key
28
+ *
29
+ * @param string $key The API Key
30
+ *
31
+ * @return bool
32
+ */
33
+ public function setKey ($ key ): bool
34
+ {
35
+ return self ::setToken ($ key );
36
+ }
37
+
38
+ /**
39
+ * Get the API Key
40
+ *
41
+ * @return string
42
+ */
43
+ public function getToken (): string
27
44
{
28
45
return self ::$ APIKey ;
29
46
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace Greip \API \Enums ;
3
+
4
+ use ReflectionClass ;
5
+
6
+ abstract class Language
7
+ {
8
+ const AR = "AR " ;
9
+ const EN = "EN " ;
10
+ const DE = "DE " ;
11
+ const FR = "FR " ;
12
+ const ES = "ES " ;
13
+ const JA = "JA " ;
14
+ const ZH = "ZH " ;
15
+ const RU = "RU " ;
16
+
17
+ /**
18
+ * Get all constants of this class
19
+ *
20
+ * @return array
21
+ */
22
+ public static function values ()
23
+ {
24
+ $ reflector = new ReflectionClass (__CLASS__ );
25
+ return $ reflector ->getConstants ();
26
+ }
27
+
28
+ /**
29
+ * Checks if a constant exist by value
30
+ *
31
+ * @param string $constant_value E.g: `isExist('dash')`.
32
+ * @return boolean
33
+ */
34
+ public static function isExist ($ constant_value )
35
+ {
36
+ $ constants = self ::values ();
37
+ return in_array ($ constant_value , $ constants , true );
38
+ }
39
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace Greip \API \Enums ;
3
+
4
+ use ReflectionClass ;
5
+
6
+ abstract class Mode
7
+ {
8
+ const LIVE = "live " ;
9
+ const DEVELOPMENT = "test " ;
10
+
11
+ /**
12
+ * Get all constants of this class
13
+ *
14
+ * @return array
15
+ */
16
+ public static function values ()
17
+ {
18
+ $ reflector = new ReflectionClass (__CLASS__ );
19
+ return $ reflector ->getConstants ();
20
+ }
21
+
22
+ /**
23
+ * Checks if a constant exist by value
24
+ *
25
+ * @param string $constant_value E.g: `isExist('dash')`.
26
+ * @return boolean
27
+ */
28
+ public static function isExist ($ constant_value )
29
+ {
30
+ $ constants = self ::values ();
31
+ return in_array ($ constant_value , $ constants , true );
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+ namespace Greip \API \Enums ;
3
+
4
+ use ReflectionClass ;
5
+
6
+ abstract class Param
7
+ {
8
+ const LANGUAGE = "language " ;
9
+ const FLAG = "flag " ;
10
+ const CURRENCY = "currency " ;
11
+ const TIMEZONE = "timezone " ;
12
+ const LOCATION = "location " ;
13
+ const SECURITY = "security " ;
14
+ const DEVICE = "device " ;
15
+
16
+ /**
17
+ * Get all constants of this class
18
+ *
19
+ * @return array
20
+ */
21
+ public static function values ()
22
+ {
23
+ $ reflector = new ReflectionClass (__CLASS__ );
24
+ return $ reflector ->getConstants ();
25
+ }
26
+
27
+ /**
28
+ * Checks if a constant exist by value
29
+ *
30
+ * @param string $constant_value E.g: `isExist('dash')`.
31
+ * @return boolean
32
+ */
33
+ public static function isExist ($ constant_value )
34
+ {
35
+ $ constants = self ::values ();
36
+ return in_array ($ constant_value , $ constants , true );
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments