Skip to content

Commit

Permalink
Symfony upgrade and add new way to delete a short code (#14)
Browse files Browse the repository at this point in the history
* update to symfony 6.4 lts

* fix mutation tests

* add symfony runtime

* add delete by path function

* update README and CHANGELOG
  • Loading branch information
patrick-blom authored Oct 4, 2024
1 parent 39f675b commit ce52590
Show file tree
Hide file tree
Showing 23 changed files with 3,081 additions and 1,407 deletions.
2 changes: 0 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=f9faeb976a49fd83f90f4485d25b8cef
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS='^localhost|example\.com$'
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
Expand Down
32 changes: 4 additions & 28 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,23 @@ name: Shorty

on:
push:
branches: [ "master" ]
branches: [ "main" ]
pull_request:
branches: [ "master" ]
branches: [ "main" ]

permissions:
contents: read

jobs:
testing-against-php8-0:
testing-against-php8-3:
runs-on: ubuntu-latest
steps:
# To automatically get bug fixes and new Php versions for shivammathur/setup-php,
# change this to (see https://github.com/shivammathur/setup-php#bookmark-versioning):
# uses: shivammathur/setup-php@v2
- uses: shivammathur/setup-php@v2 #2cb9b829437ee246e9b3cac53555a39208ca6d28
with:
php-version: '8.0'
- uses: actions/checkout@v3
- name: Copy .env.test.local
run: php -r "file_exists('.env.test.local') || copy('.env.test', '.env.test.local');"
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Execute tests and static analysis
run: composer test
testing-against-php8-1:
runs-on: ubuntu-latest
steps:
# To automatically get bug fixes and new Php versions for shivammathur/setup-php,
# change this to (see https://github.com/shivammathur/setup-php#bookmark-versioning):
# uses: shivammathur/setup-php@v2
- uses: shivammathur/setup-php@v2 #2cb9b829437ee246e9b3cac53555a39208ca6d28
with:
php-version: '8.1'
php-version: '8.3'
- uses: actions/checkout@v3
- name: Copy .env.test.local
run: php -r "file_exists('.env.test.local') || copy('.env.test', '.env.test.local');"
Expand Down
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/log/
/vendor/
###< symfony/framework-bundle ###

.idea
infection.log
/bin/.phpunit
###> squizlabs/php_codesniffer ###
/.phpcs-cache
/phpcs.xml
Expand All @@ -18,3 +21,12 @@ infection.log
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###

###> phpstan/phpstan ###
phpstan.neon
###< phpstan/phpstan ###

###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
## [0.4.0] - 2024-10-04
### Added
- GitHub actions pipeline for PHP 8.3
- Delete by path possibility, cause Akamai blocks DELETE requests with bodies
### Changed
- Set php requirements to PHP 8.3
- Update symfony from 5.4 LTS to 6.4 LTS incl. dependencies
- Edit the README.md
### Removed
- GitHub actions pipeline for PHP 8.0 & 8.1

## [0.3.1] - 2022-11-25
### Added
- GitHub actions pipeline for php 8.0 & 8.1
- GitHub actions pipeline for PHP 8.0 & 8.1
### Changed
- PHPStan lvl from 3 to 5
- Edit PHPUnit config to prevent deprecation warnings
Expand All @@ -12,7 +23,7 @@
## [0.3.0] - 2022-11-03
### Changed
- Update symfony from 4.4 to 5.4 LTS incl. dependencies
- Update for php 8.1
- Update for PHP 8.1
- Add test credentials to .env.test
- Prevent migrations from autoloading
### Removed
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ curl -X DELETE -H 'Authorization: 5449f071773861dca4d3b459aa79fcf5' -d '950a0065
http://127.0.0.1:8000: Your running Shorty
```

You can also delete a short link by passing the short code to the path of the uri. This was added because a body on a
DELETE call is not always accepted. E.g. Akamai does not allow DELETE requests which includes a body. The Authorization
Header is always required.

```
curl -X DELETE -H 'Authorization: 5449f071773861dca4d3b459aa79fcf5' http://127.0.0.1:8000/950a0065
```

If everything works as expected, Shorty will return a 410 HTTP Gone Response.
Otherwise you will end up with an 400 HTTP Bad Request Response.

Expand Down
41 changes: 21 additions & 20 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,32 @@
"type": "project",
"license": "MIT",
"require": {
"php": "^8.0",
"php": "^8.3",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/doctrine-bundle": "^2.7",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/annotations": "*",
"doctrine/doctrine-bundle": "*",
"doctrine/doctrine-migrations-bundle": "*",
"doctrine/orm": "^2.13",
"ocramius/package-versions": "2.6.0",
"ocramius/package-versions": "2.9.*",
"symfony/apache-pack": "^1.0",
"symfony/console": "5.4.*",
"symfony/doctrine-bridge": "5.4.*",
"symfony/dotenv": "5.4.*",
"symfony/flex": "^2.2",
"symfony/framework-bundle": "5.4.*",
"symfony/proxy-manager-bridge": "5.4.*",
"symfony/yaml": "5.4.*"
"symfony/console": "6.*",
"symfony/doctrine-bridge": "6.*",
"symfony/dotenv": "6.*",
"symfony/flex": "^2.4",
"symfony/framework-bundle": "6.*",
"symfony/proxy-manager-bridge": "6.*",
"symfony/runtime": "6.*",
"symfony/yaml": "6.*"
},
"require-dev": {
"infection/infection": "^0.26.16",
"infection/infection": "^0.26",
"phpmd/phpmd": "^2.13",
"phpstan/phpstan": "^1.8.11",
"phpunit/phpunit": "9.5.25",
"squizlabs/php_codesniffer": "^3.7",
"symfony/browser-kit": "5.4.*",
"symfony/css-selector": "5.4.*",
"symfony/browser-kit": "6.*",
"symfony/css-selector": "6.*",
"symfony/maker-bundle": "^1.47",
"symfony/phpunit-bridge": "^6.1"
},
Expand All @@ -36,7 +39,8 @@
"sort-packages": true,
"allow-plugins": {
"infection/extension-installer": true,
"symfony/flex": true
"symfony/flex": true,
"symfony/runtime": true
}
},
"autoload": {
Expand All @@ -52,10 +56,7 @@
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
"symfony/polyfill-iconv": "*"
},
"scripts": {
"auto-scripts": {
Expand Down Expand Up @@ -96,7 +97,7 @@
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.4.*"
"require": "6.*"
}
}
}
Loading

0 comments on commit ce52590

Please sign in to comment.