Download the PHP package moe-mizrak/aws-rekognition without Composer
On this page you can find all versions of the php package moe-mizrak/aws-rekognition. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download moe-mizrak/aws-rekognition
More information about moe-mizrak/aws-rekognition
Files in moe-mizrak/aws-rekognition
Package aws-rekognition
Short Description Laravel package for AWS Rekognition API (PHP 8)
License MIT
Homepage https://github.com/moe-mizrak/aws-rekognition
Informations about the package aws-rekognition
AWS Rekognition API for Laravel
Laravel package for AWS Rekognition API (PHP 8)
Amazon Rekognition is a cloud-based image and video analysis service that makes it easy to add advanced computer vision capabilities to your applications. The service is powered by proven deep learning technology and it requires no machine learning expertise to use. Amazon Rekognition includes a simple, easy-to-use API that can quickly analyze any image or video file thatβs stored in Amazon S3.
Table of Contents
- π€ Requirements
- π Get Started
- π§© Configuration
- π¨ Usage
- Detect Labels
- Collections
- Create Collection
- Delete Collection
- List Collections
- User
- Create User
- Delete User
- List Users
- Face
- Index Faces
- Associate Faces
- List Faces
- Delete Faces
- Search Users By Image
- π« Contributing
- π License
π€ Requirements
- PHP 8.2 or higher
π Get Started
You can install the package via composer:
You can publish the aws-rekognition
config file with:
This is the contents of the published config file:
π§© Configuration
After publishing the aws-rekognition
config file, you'll need to add the following environment variables to your .env file:
- credentials: AWS credentials for accessing the Rekognition API. Please refer to the
Get Access Key ID and Secret Access Key for AWS:
- AWS_ACCESS_KEY_ID: The AWS access key ID.
- AWS_SECRET_ACCESS_KEY: The AWS secret access key.
[!IMPORTANT] Give following Permissions to the IAM user for accessing the Rekognition API:
AmazonRekognitionFullAccess
AmazonS3FullAccess
- AWS_REGION: The AWS region where the Rekognition API is located (default: us-east-1).
[!CAUTION] The region for the S3 bucket containing the S3 object must match the region you use for Amazon Rekognition operations.
- AWS_VERSION: The version of the Rekognition API (default: latest).
For more info, please refer to AWS Client.
π¨ Usage
The Rekognition
facade offers a convenient way to make AWS Rekognition API requests.
[!NOTE] AWS Rekognition API offers over 10 primary operations across various categories for image and video analysis, but this package currently supports only a handful of them.
Contributions are highly encouraged! If you'd like to add support for more operations, feel free to contribute to the package.
Check out the full list of Rekognition operations Amazon Rekognition.
Following Rekognition API operations are supported:
- Detect Labels
- Collections
- Create Collection
- Delete Collection
- List Collections
- User
- Create User
- Delete User
- List Users
- Face
- Index Faces
- Associate Faces
- List Faces
- Delete Faces
- Search Users By Image
[!TIP] All classes include comprehensive DocBlock comments and detailed documentation to enhance readability and understanding.
Refer to the class definitions for a complete overview of methods, parameters, and their usage.
Detect Labels
Detects instances of real-world entities within an image (JPEG or PNG) provided as input. This includes objects like flower, tree, and table; events like wedding, graduation, and birthday party; and concepts like landscape, evening, and nature.
Labels supported by Rekognition label detection operations can be found in Detecting Objects and Concepts.
First of all, you need to create an instance of ImageData
object by providing the image bytes of an image file.
Alternatively, you can use S3 as the image source:
For more details, see [S3Object](https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-rekognition-2016-06-27.html#shape-s3object) section.To send a detect labels request, you need to create an instance of DetectLabelsData
object.
More optional parameters can be provided to the DetectLabelsData object:
Check out [`DetectLabelsData`](src/Data/DetectLabelsData.php) class for optional parameters and their descriptions. For more details, see [DetectLabels](https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-rekognition-2016-06-27.html#detectlabels) section.Then, you can send the request using the Rekognition
facade detectLabels
method.
Response will be an instance of DetectLabelsResultData
object.
This is the sample DetectLabelsResultData:
Collections
The face collection is the primary Amazon Rekognition resource. A collection is a container for faces that you want to search, compare, or store.
Check out Managing Face Collections, Faces, and Users for more details.
Create Collection
Creates a collection in an AWS Region.
To create a collection, you need to create an instance of CreateCollectionData
object:
Then, you can send the request using the Rekognition
facade createCollection
method:
Response will be an instance of CreateCollectionResultData
object.
[!TIP]
CreateCollectionResultData
contains thecollectionArn
- Amazon Resource Name (ARN) of the collection. You can use this to manage permissions on your resources.Please refer to Identify AWS resources with Amazon Resource Names (ARNs) for more details.
This is the sample CreateCollectionResultData:
Delete Collection
Deletes the specified collection with the provided collectionId
.
[!WARNING] Deleting a collection also removes all faces in the collection.
To delete a collection, you need to create an instance of DeleteCollectionData
object:
Then, you can send the request using the Rekognition
facade deleteCollection
method:
Response will be an instance of DeleteCollectionResultData
object.
This is the sample DeleteCollectionResultData:
List Collections
Returns the list of collections in the AWS account.
To list collections, you need to create an instance of ListCollectionsData
object:
Then, you can send the request using the Rekognition
facade listCollections
method:
Response will be an instance of ListCollectionsResultData
object.
This is the sample ListCollectionsResultData:
User
AWS Rekognition user is entity that represents a face in a collection.
Create User
Creates a new user within a collection specified by collectionId and unique userId.
To create a user, you need to create an instance of UserData
object:
[!NOTE]
userId
needs to be unique within the collection.
Then, you can send the request using the Rekognition
facade createUser
method:
Response will be an instance of UserResultData
object.
[!NOTE] The result for the
createUser
request is always empty, only metadata is returned inUserResultData
.
This is the sample UserResultData:
Delete User
Deletes a user from a collection specified by collectionId and userId.
[!NOTE] Faces that are associated with the userId are disassociated from the userId before deleting the specified userId.
To delete a user, you need to create an instance of UserData
object:
Then, you can send the request using the Rekognition
facade deleteUser
method:
Response will be an instance of UserResultData
object.
[!NOTE] The result for the
deleteUser
request is always empty, only metadata is returned inUserResultData
.
This is the sample UserResultData:
List Users
Lists the users in a collection specified by collectionId.
To list users, you need to create an instance of ListUsersData
object:
Then, you can send the request using the Rekognition
facade listUsers
method:
Response will be an instance of ListUsersResultData
object.
This is the sample ListUsersResultData:
Face
AWS Rekognition face is an entity that represents a detected and indexed face in a collection.
Index Faces
Detects faces in the input image and adds them to the specified collection.
First of all, you need to create an instance of ImageData
object by providing the image bytes of an image file.
Alternatively, you can use S3 as the image source:
For more details, see [S3Object](https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-rekognition-2016-06-27.html#shape-s3object) section.Then, in order to index faces, you need to create an instance of IndexFacesData
object:
[!NOTE] 1)
detectionAttributes
: Requesting more attributes may increase response time. 2)maxFaces
: IndexFaces returns no more than 100 detected faces in an image, even if you specify a larger value for maxFaces.
Then, you can send the request using the Rekognition
facade indexFaces
method:
Response will be an instance of IndexFacesResultData
object.
This is the sample IndexFacesResultData:
Associate Faces
Associates one or more faces with an existing userId.
To associate faces, you need to create an instance of AssociateFacesData
object:
[!NOTE] 1) The maximum number of total faceIds per userId is 100. 2)
userMatchThreshold
: The default value is 75.0. 3)clientRequestToken
: If you use the same token with multiple associate faces requests, the same response is returned. Use clientRequestToken to prevent the same request from being processed more than once.
Then, you can send the request using the Rekognition
facade associateFaces
method:
Response will be an instance of AssociateFacesResultData
object.
This is the sample AssociateFacesResultData:
List Faces
Lists the faces in a collection specified by collectionId.
To list faces, you need to create an instance of ListFacesData
object:
Then, you can send the request using the Rekognition
facade listFaces
method:
Response will be an instance of ListFacesResultData
object.
This is the sample ListFacesResultData:
Delete Faces
Deletes faces from a collection specified by collectionId and faceIds.
To delete faces, you need to create an instance of DeleteFacesData
object:
Then, you can send the request using the Rekognition
facade deleteFaces
method:
Response will be an instance of DeleteFacesResultData
object.
This is the sample DeleteFacesResultData:
Search Users By Image
Searches for userIds using a supplied image. It first detects the largest face in the image, and then searches a specified collection for matching userIds.
First of all, you need to create an instance of ImageData
object by providing the image bytes of an image file.
Alternatively, you can use S3 as the image source:
For more details, see [S3Object](https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-rekognition-2016-06-27.html#shape-s3object) section.Then, in order to search users by image, you need to create an instance of SearchUsersByImageData
object:
[!NOTE] 1)
userMatchThreshold
: The default value is 80.0 2)qualityFilter
: The default value is NONE.
Then, you can send the request using the Rekognition
facade searchUsersByImage
method:
Response will be an instance of SearchUsersByImageResultData
object.
This is the sample SearchUsersByImageResultData:
π« Contributing
Your contributions are welcome! If you'd like to improve this package, simply create a pull request with your changes. Your efforts help enhance its functionality and documentation.
If you find this package useful, please consider β it to show your support!
π License
AWS Rekognition API for Laravel is an open-sourced software licensed under the MIT license.