Skip to content

Commit

Permalink
update worflows
Browse files Browse the repository at this point in the history
benbjurstrom committed May 8, 2024
1 parent 490e58e commit 865c98a
Showing 6 changed files with 53 additions and 53 deletions.
50 changes: 25 additions & 25 deletions .github/workflows/formats.yml
Original file line number Diff line number Diff line change
@@ -17,28 +17,28 @@ jobs:

steps:

- name: Checkout
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, mbstring, zip
tools: prestissimo
coverage: pcov

- name: Install Composer dependencies
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist

- name: Coding Style Checks
run: composer test:lint

- name: Type Checks
run: composer test:types
- name: Checkout
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, mbstring, zip
tools: prestissimo
coverage: pcov

- name: Install Composer dependencies
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist

- name: Coding Style Checks
run: composer test:lint

- name: Type Checks
run: composer test:types
42 changes: 21 additions & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -16,24 +16,24 @@ jobs:

steps:

- name: Checkout
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, mbstring, zip
coverage: none

- name: Install Composer dependencies
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist

- name: Integration Tests
run: php ./vendor/bin/pest
- name: Checkout
uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, mbstring, zip
coverage: none

- name: Install Composer dependencies
run: composer update --${{ matrix.dependency-version }} --no-interaction --prefer-dist

- name: Integration Tests
run: php ./vendor/bin/pest
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
This is a framework-agnostic PHP client for [Cloudflare Images](https://developers.cloudflare.com/images/cloudflare-images/) built on the amazing [Saloon v2](https://docs.saloon.dev/) 🤠 library.

[![Latest Version on Packagist](https://img.shields.io/packagist/v/benbjurstrom/cloudflare-images-php.svg?style=flat-square)](https://packagist.org/packages/benbjurstrom/cloudflare-images-php)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/benbjurstrom/cloudflare-images-php/tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/benbjurstrom/cloudflare-images-php/actions?query=workflow%3tests+branch%3Amain)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/benbjurstrom/replicate-php/tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/benbjurstrom/cloudflare-images-php/actions?query=workflow%3tests+branch%3Amain)

## Table of contents
- [Quick Start](https://github.com/benbjurstrom/cloudflare-images-php#-quick-start)
@@ -31,7 +31,7 @@ composer require benbjurstrom/cloudflare-images-php
```
###

Use your Cloudflare API token and Account ID to create a new api instance.
Create a new api instance.
```php
use BenBjurstrom\CloudflareImages\CloudflareImages;
...
@@ -43,15 +43,15 @@ $api = new CloudflareImages(
```
###

Then use the api instance to get details about an existing image such as its file name, metadata, or available variants.
Then use it to get details about an existing image.
```php
$id = '2cdc28f0-017a-49c4-9ed7-87056c83901'
$data = $api->images()->get($id);
$data->variants[0]; // https://imagedelivery.net/Vi7wi5KSItxGFsWRG2Us6Q/2cdc28f0-017a-49c4-9ed7-87056c83901/public
```
###

Or use the api to upload a new image from an image string.
Or to upload a new image from an image string.
```php
$fileName = 'example.jpg';
$file = file_get_contents($fileName);
2 changes: 1 addition & 1 deletion src/Data/ImageData.php
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ public static function fromResponse(Response $response): self
throw new Exception('Invalid response');
}

return new static(
return new self(
id: $data['id'],
filename: $data['filename'],
uploaded: $data['uploaded'],
2 changes: 1 addition & 1 deletion src/Data/UploadUrlData.php
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ public static function fromResponse(Response $response): self
throw new \Exception('Invalid response');
}

return new static(
return new self(
id: $data['id'],
uploadUrl: $data['uploadURL'],
);
2 changes: 1 addition & 1 deletion tests/FeatureTest.php
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
->withCustomId('97ed2d63-d1e3-43ca-95dd-35192ce278c7')
->createFromUrl('https://upload.wikimedia.org/wikipedia/en/a/a9/Example.jpg');

// $signed = $api->signUrl('https://imagedelivery.net/tlMUIgxBCDMUcIu6pbnihg/058aae72-20b6-4eb5-c75c-dd0ca9e87601/public');
// $signed = $api->signUrl('https://imagedelivery.net/tlMUIgxBCDMUcIu6pbnihg/058aae72-20b6-4eb5-c75c-dd0ca9e87601/public');

dd($data);
// dd($signed);

0 comments on commit 865c98a

Please sign in to comment.