-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ddfc0d
commit 4e383f4
Showing
12 changed files
with
309 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/vendor/ | ||
/.idea | ||
/composer.lock | ||
.phpunit.result.cache | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# aws-rekognition | ||
Laravel package for AWS Rekognition API (PHP 8) | ||
|
||
# 🚧 Under Construction 🚧 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{ | ||
"name": "moe-mizrak/aws-rekognition", | ||
"description": "Laravel package for AWS Rekognition API (PHP 8)", | ||
"keywords": [ | ||
"Moe Mizrak", | ||
"laravel", | ||
"laravel-aws-rekognition", | ||
"rekognition", | ||
"aws", | ||
"image processing", | ||
"image recognition", | ||
"video recognition", | ||
"face detection", | ||
"face compare", | ||
"machine learning", | ||
"php 8" | ||
], | ||
"type": "package", | ||
"homepage": "https://github.com/moe-mizrak/aws-rekognition", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Moe Mizrak" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.2" | ||
}, | ||
"require-dev": { | ||
"orchestra/testbench": "^9.6.1", | ||
"phpunit/phpunit": "^11.4" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"MoeMizrak\\Rekognition\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"MoeMizrak\\Rekognition\\Tests\\": "tests/" | ||
} | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"MoeMizrak\\Rekognition\\RekognitionServiceProvider" | ||
] | ||
} | ||
}, | ||
"scripts": { | ||
"test": "phpunit" | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
|
||
return [ | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<phpunit bootstrap="vendor/autoload.php" colors="true"> | ||
<testsuites> | ||
<testsuite name="Application Tests"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<php> | ||
<env name="APP_ENV" value="testing"/> | ||
</php> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace MoeMizrak\Rekognition\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
/** | ||
* Facade for AWS Rekognition. | ||
*/ | ||
class Rekognition extends Facade | ||
{ | ||
/** | ||
* Get the registered name of the component. | ||
* | ||
* @return string | ||
*/ | ||
protected static function getFacadeAccessor(): string | ||
{ | ||
return 'aws-rekognition'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace MoeMizrak\Rekognition; | ||
|
||
/** | ||
* RekognitionAPI abstract class responsible for encapsulating the RekognitionRequest class. | ||
* | ||
* @class Abstract RekognitionAPI | ||
*/ | ||
readonly abstract class RekognitionAPI | ||
{ | ||
/** | ||
* RekognitionAPI constructor. | ||
*/ | ||
public function __construct() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace MoeMizrak\Rekognition; | ||
|
||
final readonly class RekognitionRequest extends RekognitionAPI | ||
{ | ||
public function test() | ||
{ | ||
// todo for testing purposes, remove later | ||
|
||
return 'test'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
|
||
namespace MoeMizrak\Rekognition; | ||
|
||
use Illuminate\Foundation\AliasLoader; | ||
use Illuminate\Support\ServiceProvider; | ||
use MoeMizrak\Rekognition\Facades\Rekognition; | ||
|
||
/** | ||
* Service provider for Rekognition. | ||
* | ||
* @class RekognitionServiceProvider | ||
*/ | ||
class RekognitionServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Bootstrap any application services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot(): void | ||
{ | ||
$this->registerPublishing(); | ||
} | ||
|
||
/** | ||
* Register any application services. | ||
* | ||
* @return void | ||
*/ | ||
public function register(): void | ||
{ | ||
$this->configure(); | ||
|
||
// todo modify this part for aws rekognition request | ||
// $this->app->singleton(ClientInterface::class, function () { | ||
// return $this->configureClient(); | ||
// }); | ||
|
||
$this->app->bind('aws-rekognition', function () { | ||
return new RekognitionRequest(); | ||
}); | ||
|
||
$this->app->bind(RekognitionRequest::class, function () { | ||
return $this->app->make('aws-rekognition'); | ||
}); | ||
|
||
// Register the facade alias. | ||
AliasLoader::getInstance()->alias('Rekognition', Rekognition::class); | ||
} | ||
|
||
/** | ||
* Get the services provided by the provider. | ||
* | ||
* @return array | ||
*/ | ||
public function provides(): array | ||
{ | ||
return ['aws-rekognition']; | ||
} | ||
|
||
/** | ||
* Setup the configuration. | ||
* | ||
* @return void | ||
*/ | ||
protected function configure(): void | ||
{ | ||
$this->mergeConfigFrom( | ||
__DIR__ . '/../config/aws-rekognition.php', 'aws-rekognition' | ||
); | ||
} | ||
|
||
/** | ||
* Register the package's publishable resources. | ||
* | ||
* @return void | ||
*/ | ||
protected function registerPublishing(): void | ||
{ | ||
if ($this->app->runningInConsole()) { | ||
$this->publishes([ | ||
__DIR__ . '/../config/aws-rekognition.php' => config_path('aws-rekognition.php'), | ||
], 'aws-rekognition'); | ||
} | ||
} | ||
|
||
/** | ||
* Configure the Guzzle client. | ||
* | ||
* @return \GuzzleHttp\Client | ||
*/ | ||
private function configureClient(): Client | ||
{ | ||
// todo implement for aws rekognition request | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace MoeMizrak\Rekognition\Tests; | ||
|
||
use MoeMizrak\Rekognition\Facades\Rekognition; | ||
use MoeMizrak\Rekognition\RekognitionRequest; | ||
use PHPUnit\Framework\Attributes\Test; | ||
|
||
class RekognitionRequestTest extends TestCase | ||
{ | ||
private RekognitionRequest $rekognition; | ||
|
||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->rekognition = $this->app->make(RekognitionRequest::class); | ||
} | ||
|
||
#[Test] | ||
public function it_test() | ||
{ | ||
/* SETUP */ | ||
|
||
/* EXECUTE */ | ||
$response = $this->rekognition->test(); | ||
dd($response); | ||
|
||
/* ASSERT */ | ||
} | ||
|
||
#[Test] | ||
public function it_test_facade() | ||
{ | ||
/* SETUP */ | ||
|
||
/* EXECUTE */ | ||
$response = Rekognition::test(); | ||
dd($response); | ||
|
||
/* ASSERT */ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace MoeMizrak\Rekognition\Tests; | ||
|
||
use MoeMizrak\Rekognition\Facades\Rekognition; | ||
use MoeMizrak\Rekognition\RekognitionServiceProvider; | ||
use Orchestra\Testbench\TestCase as OrchestraTestCase; | ||
|
||
class TestCase extends OrchestraTestCase | ||
{ | ||
/** | ||
* @return void | ||
*/ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
/** | ||
* @param $app | ||
* | ||
* @return string[] | ||
*/ | ||
protected function getPackageProviders($app): array | ||
{ | ||
return [ | ||
RekognitionServiceProvider::class, | ||
]; | ||
} | ||
|
||
/** | ||
* @param $app | ||
* | ||
* @return string[] | ||
*/ | ||
protected function getPackageAliases($app): array | ||
{ | ||
return [ | ||
'Rekognition' => Rekognition::class, | ||
]; | ||
} | ||
} |