Download the PHP package rikudou/aws-sdk-phpstan without Composer

On this page you can find all versions of the php package rikudou/aws-sdk-phpstan. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package aws-sdk-phpstan

AWS SDK PHPStan extension

This extension helps PHPStan to correctly determine the return type of all the SDK api calls.

Table of contents

Installation

composer require --dev rikudou/aws-sdk-phpstan

If you also install phpstan/extension-installer then you're all set!

Manual installation If you don't want to use `phpstan/extension-installer`, include extension.neon in your project's PHPStan config:

Usage

You can simply use AWS SDK as usual, except all return types are strongly typed and PHPStan knows exactly what type each key is.

Note that using treatPhpDocTypesAsCertain: false in your phpstan.neon makes this extension entirely useless as all errors reported by the strong typing will be ignored.

For example:

This prints the following:

Strict comparison using === between null and 'SomeName' will always evaluate to false.

That's because PHPStan knows that there's no property called Name!

Or something more specific:

ChecksumType indeed exists, but it's very strictly typed to only two possible values, neither of which is md5. And indeed, PHPStan tells us:

Strict comparison using === between 'COMPOSITE'|'FULL_OBJECT' and 'md5' will always evaluate to false.

If you were to dump the PHPStan type of the $object variable, you'd get the following:

How does it work?

There's a build script that traverses the official AWS SDK for PHP data and extracts type information from them. Afterwards it converts the information to a PHPStan extension class that provides dynamic types based on the method being called (for example the S3ClientReturnTypeExtension.).

Additionally, the AWS Result class is made generic using a stub file.

Fine-tuning

By default, every single one of AWS clients is generated which can slow down PHPStan significantly and is rarely needed. The build script is included as part of the package, so you can automatically generate only the classes that interest you, for example if you wanted to only work with S3Client and CloudFrontClient, you could do the following:

composer.json:

Then, as part of your process, run the vendor/bin/generate-aws-phpstan. For example using the post install script of composer.json:

If you now check the vendor/rikudou/aws-sdk-phpstan/src/Types directory, you should only see the following two files:

Additionally, the vendor/rikudou/aws-sdk-phpstan/extension.neon should now only include the two above services.


All versions of aws-sdk-phpstan with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
composer-runtime-api Version ^2.2
aws/aws-sdk-php Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rikudou/aws-sdk-phpstan contains the following files

Loading the files please wait ....