Skip to content

Commit de828f6

Browse files
committed
Setup package
0 parents  commit de828f6

12 files changed

+319
-0
lines changed

.editorconfig

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
14+
[{package.json,*.scss,*.css}]
15+
indent_size = 2
16+
17+
[*.md]
18+
trim_trailing_whitespace = false

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Path-based git attributes
2+
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3+
4+
# Ignore all test and documentation with "export-ignore".
5+
/.editorconfig export-ignore
6+
/.gitattributes export-ignore
7+
/.gitignore export-ignore
8+
/.travis.yml export-ignore
9+
/.scrutinizer.yml export-ignore
10+
/phpunit.xml.dist export-ignore
11+
/tests export-ignore

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ko_fi: ivanvermeyen
2+
custom: https://paypal.me/ivanvermeyen

.github/SECURITY.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Security Policy
2+
3+
If you discover any security related issues, please email [email protected] instead of using the issue tracker.

.github/workflows/run-tests.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Tests
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
php: [ 8.0, 8.1 ]
12+
laravel: [ 8.*, 9.*, 10.* ]
13+
dependency-version: [ prefer-stable ]
14+
exclude:
15+
- laravel: 10.*
16+
php: 8.0
17+
include:
18+
- laravel: 7.*
19+
php: 7.2
20+
testbench: 5.*
21+
- laravel: 7.*
22+
php: 8.0
23+
testbench: 5.*
24+
- laravel: 8.*
25+
php: 7.3
26+
testbench: 6.*
27+
- laravel: 8.*
28+
testbench: 6.*
29+
- laravel: 9.*
30+
testbench: 7.*
31+
- laravel: 10.*
32+
testbench: 8.*
33+
34+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
35+
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v2
39+
40+
- name: Cache dependencies
41+
uses: actions/cache@v2
42+
with:
43+
path: ~/.composer/cache/files
44+
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
45+
46+
- name: Setup PHP
47+
uses: shivammathur/setup-php@v2
48+
with:
49+
php-version: ${{ matrix.php }}
50+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick
51+
coverage: xdebug
52+
53+
- name: Install dependencies
54+
run: composer update --with="illuminate/support:${{ matrix.laravel }}" --with="orchestra/testbench:${{ matrix.testbench }}" --prefer-dist --no-interaction --no-progress
55+
56+
- name: Execute tests
57+
run: vendor/bin/phpunit --coverage-clover=coverage.xml
58+
59+
- if: github.event_name == 'push'
60+
name: Run Codacy Coverage Reporter
61+
uses: codacy/codacy-coverage-reporter-action@master
62+
with:
63+
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
64+
coverage-reports: coverage.xml

.gitignore

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

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# The MIT License (MIT)
2+
3+
Copyright (c) Ivan Vermeyen ([email protected])
4+
5+
> Permission is hereby granted, free of charge, to any person obtaining a copy
6+
> of this software and associated documentation files (the "Software"), to deal
7+
> in the Software without restriction, including without limitation the rights
8+
> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
> copies of the Software, and to permit persons to whom the Software is
10+
> furnished to do so, subject to the following conditions:
11+
>
12+
> The above copyright notice and this permission notice shall be included in
13+
> all copies or substantial portions of the Software.
14+
>
15+
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
> THE SOFTWARE.

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Laravel URI Translator
2+
3+
[![GitHub release](https://img.shields.io/github/release/codezero-be/laravel-uri-translator.svg?style=flat-square)](https://github.com/codezero-be/laravel-uri-translator/releases)
4+
[![Laravel](https://img.shields.io/badge/laravel-10-red?style=flat-square&logo=laravel&logoColor=white)](https://laravel.com)
5+
[![License](https://img.shields.io/packagist/l/codezero/laravel-uri-translator.svg?style=flat-square)](LICENSE.md)
6+
[![Build Status](https://img.shields.io/github/actions/workflow/status/codezero-be/laravel-uri-translator/run-tests.yml?style=flat-square&logo=github&logoColor=white&label=tests)](https://github.com/codezero-be/laravel-uri-translator/actions)
7+
[![Code Coverage](https://img.shields.io/codacy/coverage/ad6fcea152b449d380a187a375d0f7d7/master?style=flat-square)](https://app.codacy.com/gh/codezero-be/laravel-uri-translator)
8+
[![Code Quality](https://img.shields.io/codacy/grade/ad6fcea152b449d380a187a375d0f7d7/master?style=flat-square)](https://app.codacy.com/gh/codezero-be/laravel-uri-translator)
9+
[![Total Downloads](https://img.shields.io/packagist/dt/codezero/laravel-uri-translator.svg?style=flat-square)](https://packagist.org/packages/codezero/laravel-uri-translator)
10+
11+
[![ko-fi](https://www.ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/R6R3UQ8V)
12+
13+
Translate a URI or individual slugs, excluding route parameters.
14+
15+
## ✅ Requirements
16+
17+
- PHP >= 7.2.5
18+
- Laravel >= 7.0
19+
20+
## 📦 Install
21+
22+
Install this package with Composer:
23+
24+
```bash
25+
composer require codezero/laravel-uri-translator
26+
```
27+
28+
Laravel will automatically register the ServiceProvider.
29+
30+
### Usage
31+
32+
...
33+
34+
## 🚧 Testing
35+
36+
```bash
37+
composer test
38+
```
39+
## ☕️ Credits
40+
41+
- [Ivan Vermeyen](https://github.com/ivanvermeyen)
42+
- [All contributors](https://github.com/codezero-be/laravel-uri-translator/contributors)
43+
44+
## 🔒 Security
45+
46+
If you discover any security related issues, please [e-mail me](mailto:[email protected]) instead of using the issue tracker.
47+
48+
## 📑 Changelog
49+
50+
A complete list of all notable changes to this package can be found on the
51+
[releases page](https://github.com/codezero-be/laravel-uri-translator/releases).
52+
53+
## 📜 License
54+
55+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

composer.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "codezero/laravel-uri-translator",
3+
"description": "Translate a URI or individual slugs, excluding route parameters.",
4+
"keywords": [
5+
"php",
6+
"laravel",
7+
"locale",
8+
"language",
9+
"country",
10+
"localization",
11+
"url",
12+
"uri",
13+
"slugs"
14+
],
15+
"license": "MIT",
16+
"authors": [
17+
{
18+
"name": "Ivan Vermeyen",
19+
"email": "[email protected]"
20+
}
21+
],
22+
"require": {
23+
"php": "^7.2.5|^8.0",
24+
"illuminate/support": "^7.0|^8.0|^9.0|^10.0"
25+
},
26+
"require-dev": {
27+
"orchestra/testbench": "^5.0|^6.0|^7.0|^8.0",
28+
"phpunit/phpunit": "^8.0|^9.0"
29+
},
30+
"scripts": {
31+
"test": "phpunit"
32+
},
33+
"autoload": {
34+
"psr-4": {
35+
"CodeZero\\UriTranslator\\": "src"
36+
}
37+
},
38+
"autoload-dev": {
39+
"psr-4": {
40+
"CodeZero\\UriTranslator\\Tests\\": "tests"
41+
}
42+
},
43+
"extra": {
44+
"laravel": {
45+
"providers": [
46+
"CodeZero\\UriTranslator\\UriTranslatorServiceProvider"
47+
]
48+
}
49+
},
50+
"config": {
51+
"preferred-install": "dist",
52+
"sort-packages": true,
53+
"optimize-autoloader": true,
54+
"allow-plugins": {
55+
"kylekatarnls/update-helper": true
56+
}
57+
},
58+
"minimum-stability": "dev",
59+
"prefer-stable": true
60+
}

phpunit.xml.dist

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit backupGlobals="false"
3+
backupStaticAttributes="false"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false">
11+
<testsuites>
12+
<testsuite name="Unit">
13+
<directory suffix="Test.php">./tests/Unit</directory>
14+
</testsuite>
15+
<testsuite name="Feature">
16+
<directory suffix="Test.php">./tests/Feature</directory>
17+
</testsuite>
18+
</testsuites>
19+
<filter>
20+
<whitelist processUncoveredFilesFromWhitelist="true">
21+
<directory suffix=".php">./src</directory>
22+
</whitelist>
23+
</filter>
24+
<php>
25+
<env name="APP_ENV" value="testing"/>
26+
<env name="CACHE_DRIVER" value="array"/>
27+
<env name="SESSION_DRIVER" value="array"/>
28+
<env name="QUEUE_DRIVER" value="sync"/>
29+
</php>
30+
</phpunit>

src/UriTranslatorServiceProvider.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace CodeZero\UriTranslator;
4+
5+
use Illuminate\Support\ServiceProvider;
6+
7+
class UriTranslatorServiceProvider extends ServiceProvider
8+
{
9+
/**
10+
* Bootstrap any application services.
11+
*
12+
* @return void
13+
*/
14+
public function boot()
15+
{
16+
//
17+
}
18+
19+
/**
20+
* Register any application services.
21+
*
22+
* @return void
23+
*/
24+
public function register()
25+
{
26+
//
27+
}
28+
}

tests/TestCase.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace CodeZero\UriTranslator\Tests;
4+
5+
use CodeZero\UriTranslator\UriTranslatorServiceProvider;
6+
use Orchestra\Testbench\TestCase as BaseTestCase;
7+
8+
abstract class TestCase extends BaseTestCase
9+
{
10+
/**
11+
* Get the packages service providers.
12+
*
13+
* @param \Illuminate\Foundation\Application $app
14+
*
15+
* @return array
16+
*/
17+
protected function getPackageProviders($app)
18+
{
19+
return [
20+
UriTranslatorServiceProvider::class,
21+
];
22+
}
23+
}

0 commit comments

Comments
 (0)