Skip to content

Commit 3de5b2e

Browse files
authored
Merge pull request #31 from ADmad/cake-4.x
Cake 4.x
2 parents dd9fa55 + 4ef9318 commit 3de5b2e

File tree

20 files changed

+247
-243
lines changed

20 files changed

+247
-243
lines changed

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
.editorconfig export-ignore
33
.gitattributes export-ignore
44
.gitignore export-ignore
5-
phpunit.xml export-ignore
5+
phpunit.xml.dist export-ignore
66
.travis.yml export-ignore
77
tests export-ignore
8+
psalm.xml

.github/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
testsuite:
7+
runs-on: ubuntu-18.04
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
php-version: ['7.2', '7.4', '8.0']
12+
composer-opts: ['']
13+
include:
14+
- php-version: '7.2'
15+
composer-opts: '--prefer-lowest'
16+
17+
steps:
18+
- uses: actions/checkout@v1
19+
with:
20+
fetch-depth: 1
21+
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: ${{ matrix.php-version }}
26+
extension-csv: mbstring, intl
27+
coverage: pcov
28+
29+
- name: Composer install
30+
run: |
31+
if [[ ${{ matrix.php-version }} == '8.0' ]]; then
32+
composer update --ignore-platform-reqs
33+
else
34+
composer update ${{ matrix.composer-opts }}
35+
fi
36+
37+
- name: Run PHPUnit
38+
run: |
39+
if [[ ${{ matrix.php-version }} == '7.4' ]]; then
40+
vendor/bin/phpunit --coverage-clover=coverage.xml
41+
else
42+
vendor/bin/phpunit
43+
fi
44+
45+
- name: Code Coverage Report
46+
if: matrix.php-version == '7.4'
47+
uses: codecov/codecov-action@v1
48+
49+
cs-stan:
50+
name: Coding Standard & Static Analysis
51+
runs-on: ubuntu-18.04
52+
53+
steps:
54+
- uses: actions/checkout@v1
55+
with:
56+
fetch-depth: 1
57+
58+
- name: Setup PHP
59+
uses: shivammathur/setup-php@v2
60+
with:
61+
php-version: '7.4'
62+
extension-csv: mbstring, intl
63+
coverage: none
64+
tools: cs2pr, psalm:^4.1
65+
66+
- name: Composer Install
67+
run: composer require cakephp/cakephp-codesniffer:^4.1
68+
69+
- name: Run phpcs
70+
run: vendor/bin/phpcs --report=checkstyle -q --standard=vendor/cakephp/cakephp-codesniffer/CakePHP src/ tests/ | cs2pr
71+
72+
- name: Run psalm
73+
if: success() || failure()
74+
run: psalm --output-format=github

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/composer.lock
22
/vendor
3+
.phpunit.result.cache

.scrutinizer.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.styleci.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

.travis.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
# CakePHP Glide
22

3-
[![Build Status](https://img.shields.io/travis/ADmad/cakephp-glide/master.svg?style=flat-square)](https://travis-ci.org/ADmad/cakephp-glide)
3+
[![Build Status](https://img.shields.io/github/workflow/status/ADmad/cakephp-glide/CI/master?style=flat-square)](https://github.com/ADmad/cakephp-glide/actions?query=workflow%3ACI+branch%3Amaster)
44
[![Coverage Status](https://img.shields.io/codecov/c/github/ADmad/cakephp-glide.svg?style=flat-square)](https://codecov.io/github/ADmad/cakephp-glide)
55
[![Total Downloads](https://img.shields.io/packagist/dt/ADmad/cakephp-glide.svg?style=flat-square)](https://packagist.org/packages/ADmad/cakephp-glide)
66
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE.txt)
77

8-
CakePHP 3.x plugin to help using [Glide](http://glide.thephpleague.com/) image manipulation library.
8+
CakePHP plugin to help using [Glide](http://glide.thephpleague.com/) image manipulation library.
99

1010
The plugin consists of a middlware, view helper and a Glide response class.
1111

12-
## Requirements
13-
14-
* CakePHP 3.5+ (For 3.4 and below use 2.x, for 3.2 and below use 1.x)
15-
1612
## Installation
1713

1814
Install the plugin through composer:
@@ -21,10 +17,10 @@ Install the plugin through composer:
2117
composer require admad/cakephp-glide
2218
```
2319

24-
Load the plugin in `config/bootstrap.php`:
20+
Load the plugin using CLI:
2521

26-
```
27-
Plugin::load('ADmad/Glide');
22+
```sh
23+
bin/cake plugin load ADmad/Glide
2824
```
2925

3026
## Usage
@@ -37,7 +33,7 @@ intercepts requests and serves images generated by Glide. For e.g.:
3733
```php
3834
Router::scope('/images', function ($routes) {
3935
$routes->registerMiddleware('glide', new \ADmad\Glide\Middleware\GlideMiddleware([
40-
// Run this filter only for URLs starting with specified string. Default null.
36+
// Run this middleware only for URLs starting with specified string. Default null.
4137
// Setting this option is required only if you want to setup the middleware
4238
// in Application::middleware() instead of using router's scoped middleware.
4339
// It would normally be set to same value as that of server.base_url below.
@@ -152,7 +148,7 @@ Here are the available methods of `GlideHelper`:
152148
* See `$options` argument of `Cake\View\HtmlHelper::image()`.
153149
* @return string Complete <img> tag.
154150
*/
155-
GlideHelper::image($path, array $params = [], array $options = [])
151+
GlideHelper::image(string $path, array $params = [], array $options = []): string
156152

157153
/**
158154
* URL with query string based on resizing params.
@@ -161,9 +157,9 @@ Here are the available methods of `GlideHelper`:
161157
* @param array $params Image manipulation parameters.
162158
* @return string Image URL.
163159
*/
164-
GlideHelper::url($path, array $params = [])
160+
GlideHelper::url(string $path, array $params = []): string
165161
```
166162

167163
The main benefit of using this helper is depending on the value of `secureUrls`
168164
config, the generated URLs will contain a token which will be verified by the
169-
dispatch filter. The prevents modification of query string params.
165+
middleware. The prevents modification of query string params.

composer.json

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "admad/cakephp-glide",
3-
"description": "CakePHP 3.x plugin for using Glide image manipulation library.",
3+
"description": "CakePHP plugin for using Glide image manipulation library.",
44
"type": "cakephp-plugin",
55
"keywords": [
66
"cakephp",
@@ -28,24 +28,21 @@
2828
"issues":"https://github.com/ADmad/cakephp-glide/issues"
2929
},
3030
"require": {
31-
"cakephp/cakephp": "^3.5",
32-
"league/glide": "^1.3"
31+
"cakephp/cakephp": "^4.0.2",
32+
"league/glide": "^1.6"
3333
},
3434
"require-dev": {
35-
"cakephp/chronos": "^1.1",
36-
"phpunit/phpunit": "^5.7.14|^6.0"
35+
"phpunit/phpunit": "^8.5 || ^9.3"
3736
},
3837
"autoload": {
3938
"psr-4": {
4039
"ADmad\\Glide\\": "src"
41-
},
42-
"files": [
43-
"deprecations.php"
44-
]
40+
}
4541
},
4642
"autoload-dev": {
4743
"psr-4": {
48-
"ADmad\\Glide\\Test\\": "tests"
44+
"ADmad\\Glide\\Test\\": "tests",
45+
"TestApp\\": "tests/test_app/src"
4946
}
5047
}
5148
}

deprecations.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

phpunit.xml.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
colors="true"
44
processIsolation="false"
55
stopOnFailure="false"
6-
syntaxCheck="false"
76
bootstrap="./tests/bootstrap.php"
87
>
98
<php>

0 commit comments

Comments
 (0)