1.0.4 2022-05-22 09:29 UTC

This package is auto-updated.

Last update: 2022-05-22 09:33:54 UTC


Latest Stable Version Total Downloads Build Status codecov StyleCI PHPStan

AWS S3 Logs Parser is a simple PHP package to parse Amazon Simple Storage Service (Amazon S3) logs into a readable JSON format. The detailed usage report will show you how much times a file is downloaded and how much bytes are transferred.

Getting Started

  1. Sign up for AWS – Before you begin, you need to sign up for an AWS account and retrieve your AWS credentials.
  2. Create your own bucket – Now that you've signed up for Amazon S3, you're ready to create a bucket using the AWS Management Console.
  3. Enable server access logging – When you enable logging, Amazon S3 delivers access logs for a source bucket to a target bucket that you choose.
  4. Install the service – Using Composer is the recommended way to install it. The service is available via Packagist under the mtrdesign/s3-logs-parser package.
$ composer require mtrdesign/s3-logs-parser


Create a service instance:


use S3LogsParser\S3LogsParser;

$S3LogsParser = new S3LogsParser([
    'version' => 'latest',
    'region' => $awsBucketRegion,
    'access_key' => $awsAccessKey,
    'secret_key' => $awsSecretKey,


Optionally, you can set and update service configurations via setConfigs() method:


    'version' => 'latest',
    'region' => $awsBucketRegion,
    'access_key' => $awsAccessKey,
    'secret_key' => $awsSecretKey,


Finally, you can get file's download and bandwidth statistics for a specific date in this way:


$S3LogsParser->getStats($awsBucketName, $awsBucketPrefix, $date);


It is recommended to pass Carbon date string to this method.

This is how service response should look like:



Ensure all the guides are followed and style/test checkers pass before pushing your code.


Installation steps

  1. Build the required services and Docker container with $ make docker-build
  2. SSH into the container with $ make docker-bash
  3. Confirm code style checker passes with $ make run-phpcs
  4. Confirm code quality checker passes with $ make run-phpstan
  5. Confirm code texts checker passes with $ make run-phpunit


AWS S3 Logs Parser is open source and available under the MIT License.