PHP code example of modulusphp / aws-sdk

1. Go to this page and download the library: Download modulusphp/aws-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

modulusphp / aws-sdk example snippets




return [
  'credentials' => [
    'key'    => env('AWS_ACCESS_KEY_ID', ''),
    'secret' => env('AWS_SECRET_ACCESS_KEY', ''),
  ],
  'region' => env('AWS_REGION', 'eu-west-1'),
  'version' => 'latest'
];


'channels' => [
  ...

  'cloudwatch' => [
    'driver' => 'cloudwatch',
    'group_name' => env('CLOUDWATCH_GROUP_NAME', '/aws/modulus/application'),
    'steam_name' => env('CLOUDWATCH_STREAM_NAME', 'ec2-instance'),
    'days' => 14
  ]
];

use Modulus\Framework\Upstart\Service;
use Modulus\Hibernate\Logging\MonologBase;

class AppServiceResolver extends Service
{
  /**
   * Register application services
   *
   * @param mixed $app
   * @return void
   */
  protected function boot($app) : void {
    MonologBase::register(
      'cloudwatch',
      \Modulus\Aws\Services\CloudWatch\MonologDriver::class
    );
  }
}

\Log::channel('cloudwatch')->info('Successfully created a new user', ['name' => 'Donald', 'age' => 22]);



return [
  'default' => 'cloudwatch',
  ...

\Log::alert('Could not create user', ['name' => 'Donald']);