Skip to content

Commit

Permalink
Drop support for PHP 5.6 and 7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
const-cloudinary committed Dec 16, 2024
1 parent ff8bd3d commit 3f74b47
Show file tree
Hide file tree
Showing 15 changed files with 77 additions and 360 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
fail-fast: false
matrix:
php-versions:
- '5.6'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
60 changes: 39 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,47 @@

Cloudinary PHP SDK
==================

## About

The Cloudinary PHP SDK allows you to quickly and easily integrate your application with Cloudinary.
Effortlessly optimize, transform, upload and manage your cloud's assets.


#### Note

This Readme provides basic installation and usage information.
For the complete documentation, see the [PHP SDK Guide](https://cloudinary.com/documentation/php_integration).

## Table of Contents

- [Key Features](#key-features)
- [Version Support](#Version-Support)
- [Installation](#installation)
- [Usage](#usage)
- [Setup](#Setup)
- [Transform and Optimize Assets](#Transform-and-Optimize-Assets)


## Key Features

- [Transform](https://cloudinary.com/documentation/php_video_manipulation#video_transformation_examples) and
[optimize](https://cloudinary.com/documentation/php_image_manipulation#image_optimizations) assets.
- Generate [image](https://cloudinary.com/documentation/php_image_manipulation#deliver_and_transform_images) and
[video](https://cloudinary.com/documentation/php_video_manipulation#php_video_transformation_code_examples) tags.
- [Asset Management](https://cloudinary.com/documentation/php_asset_administration).
- [Secure URLs](https://cloudinary.com/documentation/video_manipulation_and_delivery#generating_secure_https_urls_using_sdks).



## Version Support

| SDK Version | PHP 5.4 | PHP 5.5 | PHP 5.6 | PHP 7.x | PHP 8.x |
|-------------|---------|---------|---------|---------|---------|
| 2.x | x | x | v | v | v |
| 1.x | v | v | v | v | x |
| SDK Version | PHP 5.4 | PHP 5.5 | PHP 5.6 | PHP 7.x | PHP 8.0 - 8.3 | PHP 8.4 |
|-------------|---------|---------|---------|---------|---------------|---------|
| 3.x |||||||
| 2.x |||||| ✘ * |
| 1.x |||||||

\* Deprecation warnings

## Installation

```bash
composer require "cloudinary/cloudinary_php"
```
Expand All @@ -56,57 +60,71 @@ on migrating to this version of the PHP SDK.
The previous (1.x) version of the SDK is located [here](https://github.com/cloudinary/cloudinary_php/tree/support/1.x).

### Setup

```php
use Cloudinary\Cloudinary;

$cloudinary = new Cloudinary();
```

### Transform and Optimize Assets

- [See full documentation](https://cloudinary.com/documentation/php_image_manipulation).

```php
$cloudinary->image('sample.jpg')->resize(Resize::fill()->width(100)->height(150))->format(Format::auto());
```

### Upload

- [See full documentation](https://cloudinary.com/documentation/php_image_and_video_upload).
- [Learn more about configuring your uploads with upload presets](https://cloudinary.com/documentation/upload_presets).

```php
$cloudinary->uploadApi->upload('my_image.jpg');
```

### Security options

- [See full documentation](https://cloudinary.com/documentation/solution_overview#security).

## Contributions

- Ensure tests run locally
- Open a PR and ensure Travis tests pass


## Get Help

If you run into an issue or have a question, you can either:

- Issues related to the SDK: [Open a GitHub issue](https://github.com/cloudinary/cloudinary_php/issues).
- Issues related to your account: [Open a support ticket](https://cloudinary.com/contact)


## About Cloudinary
Cloudinary is a powerful media API for websites and mobile apps alike, Cloudinary enables developers to efficiently
manage, transform, optimize, and deliver images and videos through multiple CDNs. Ultimately, viewers enjoy responsive
and personalized visual-media experiences—irrespective of the viewing device.

Cloudinary is a powerful media API for websites and mobile apps alike, Cloudinary enables developers to efficiently
manage, transform, optimize, and deliver images and videos through multiple CDNs. Ultimately, viewers enjoy responsive
and personalized visual-media experiences—irrespective of the viewing device.

## Additional Resources
- [Cloudinary Transformation and REST API References](https://cloudinary.com/documentation/cloudinary_references): Comprehensive references, including syntax and examples for all SDKs.

- [Cloudinary Transformation and REST API References](https://cloudinary.com/documentation/cloudinary_references):
Comprehensive references, including syntax and examples for all SDKs.
- [MediaJams.dev](https://mediajams.dev/): Bite-size use-case tutorials written by and for Cloudinary Developers
- [DevJams](https://www.youtube.com/playlist?list=PL8dVGjLA2oMr09amgERARsZyrOz_sPvqw): Cloudinary developer podcasts on YouTube.
- [Cloudinary Academy](https://training.cloudinary.com/): Free self-paced courses, instructor-led virtual courses, and on-site courses.
- [Code Explorers and Feature Demos](https://cloudinary.com/documentation/code_explorers_demos_index): A one-stop shop for all code explorers, Postman collections, and feature demos found in the docs.
- [Cloudinary Roadmap](https://cloudinary.com/roadmap): Your chance to follow, vote, or suggest what Cloudinary should develop next.
- [Cloudinary Facebook Community](https://www.facebook.com/groups/CloudinaryCommunity): Learn from and offer help to other Cloudinary developers.
- [DevJams](https://www.youtube.com/playlist?list=PL8dVGjLA2oMr09amgERARsZyrOz_sPvqw): Cloudinary developer podcasts on
YouTube.
- [Cloudinary Academy](https://training.cloudinary.com/): Free self-paced courses, instructor-led virtual courses, and
on-site courses.
- [Code Explorers and Feature Demos](https://cloudinary.com/documentation/code_explorers_demos_index): A one-stop shop
for all code explorers, Postman collections, and feature demos found in the docs.
- [Cloudinary Roadmap](https://cloudinary.com/roadmap): Your chance to follow, vote, or suggest what Cloudinary should
develop next.
- [Cloudinary Facebook Community](https://www.facebook.com/groups/CloudinaryCommunity): Learn from and offer help to
other Cloudinary developers.
- [Cloudinary Account Registration](https://cloudinary.com/users/register/free): Free Cloudinary account registration.
- [Cloudinary Website](https://cloudinary.com): Learn about Cloudinary's products, partners, customers, pricing, and more.

- [Cloudinary Website](https://cloudinary.com): Learn about Cloudinary's products, partners, customers, pricing, and
more.

## Licence

Released under the MIT license.
82 changes: 0 additions & 82 deletions RoboFile.php

This file was deleted.

19 changes: 9 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,23 @@
"issues": "https://github.com/cloudinary/cloudinary_php/issues"
},
"require": {
"php": ">=5.6.0",
"cloudinary/transformation-builder-sdk": "^1",
"guzzlehttp/guzzle": "^6.5.8|^7.4.5",
"php": ">=8.0.0",
"cloudinary/transformation-builder-sdk": "^2",
"guzzlehttp/guzzle": "^7.4.5",
"guzzlehttp/promises": "^1.5.3|^2.0",
"guzzlehttp/psr7": "^1.9.1|^2.5",
"guzzlehttp/psr7": "^2.7",
"ext-json": "*",
"monolog/monolog": "^1|^2|^3",
"psr/log" : "^1|^2|^3"
"monolog/monolog": "^2|^3",
"psr/log" : "^2|^3"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.2",
"symfony/phpunit-bridge": "^7.2",
"phpmd/phpmd": "*",
"squizlabs/php_codesniffer": "3.*",
"squizlabs/php_codesniffer": "*",
"friendsofphp/php-cs-fixer": "*",
"ext-dom": "*",
"ext-libxml": "*",
"ext-zip": "*",
"consolidation/robo": "~1"
"ext-zip": "*"
},
"autoload": {
"classmap": [
Expand Down
49 changes: 18 additions & 31 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/5.7/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
bootstrap="vendor/autoload.php"
>
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0"/>
<env name="SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT" value="1"/>
</php>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Integration">
<directory>tests/Integration</directory>
</testsuite>
</testsuites>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="vendor/autoload.php">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[direct]=0"/>
<env name="SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT" value="1"/>
</php>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Integration">
<directory>tests/Integration</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion src/Api/Provisioning/AccountApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AccountApi
*
* @param ProvisioningConfiguration $configuration
*/
public function __construct(ProvisioningConfiguration $configuration = null)
public function __construct(?ProvisioningConfiguration $configuration = null)
{
$this->accountApiClient = new AccountApiClient($configuration);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Provisioning/AccountApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ class AccountApiClient extends BaseApiClient
*
* @param ProvisioningConfiguration $configuration
*/
public function __construct(ProvisioningConfiguration $configuration = null)
public function __construct(?ProvisioningConfiguration $configuration = null)
{
$this->init($configuration);
}

/**
* @param ProvisioningConfiguration $configuration
*/
public function init(ProvisioningConfiguration $configuration = null)
public function init(?ProvisioningConfiguration $configuration = null)
{
if ($configuration === null) {
$configuration = ProvisioningConfiguration::instance();
Expand Down
1 change: 0 additions & 1 deletion src/Log/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class Logger
E_USER_ERROR => Monolog::ERROR,
E_USER_WARNING => Monolog::WARNING,
E_USER_NOTICE => Monolog::NOTICE,
E_STRICT => Monolog::NOTICE,
E_RECOVERABLE_ERROR => Monolog::ERROR,
E_DEPRECATED => Monolog::NOTICE,
E_USER_DEPRECATED => Monolog::NOTICE,
Expand Down
24 changes: 1 addition & 23 deletions src/Log/LoggerDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,6 @@
use Monolog\Handler\TestHandler;
use Psr\Log\LoggerInterface;

/**
* Backwards compatibility with PSR Log v1.
*/
$r = new \ReflectionClass(LoggerInterface::class);
if (PHP_MAJOR_VERSION < 7 || !$r->getMethod('log')->hasReturnType()) {
/**
* Logger decorator trait that exposes PSR-3 Logger methods.
*/
trait LoggerDecoratorTrait
{
use LoggerDecoratorV1Trait;
}
} else {
/**
* Logger decorator trait that exposes PSR-3 Logger methods.
*/
trait LoggerDecoratorTrait
{
use LoggerDecoratorV3Trait;
}
}

/**
* Logger decorator that instantiates logger by configuration and exposes PSR-3 Logger methods
*/
Expand All @@ -58,7 +36,7 @@ class LoggerDecorator implements LoggerInterface
*
* @param LoggingConfig|null $config
*/
public function __construct(LoggingConfig $config = null)
public function __construct(?LoggingConfig $config = null)
{
$this->config = $config;
}
Expand Down
Loading

0 comments on commit 3f74b47

Please sign in to comment.