Skip to content

Commit cc5aebb

Browse files
author
Florent Morselli
committed
First release
1 parent 08bba95 commit cc5aebb

File tree

7 files changed

+133
-0
lines changed

7 files changed

+133
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
vendor/
2+
build/

.scrutinizer.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
before_commands:
2+
- "composer install --prefer-dist"
3+
4+
tools:
5+
external_code_coverage: true
6+
php_mess_detector: true
7+
php_code_sniffer: true
8+
php_analyzer: true
9+
sensiolabs_security_checker: true
10+
php_code_coverage: true
11+
php_sim: false
12+
php_cpd: true
13+
php_pdepend:
14+
excluded_dirs: [vendor/*, doc/*, tests/*]
15+
filter:
16+
excluded_paths: [vendor/*, doc/*, tests/*]

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
language: php
2+
3+
php:
4+
- 5.3
5+
- 5.4
6+
- 5.5
7+
- 5.6
8+
- hhvm
9+
10+
matrix:
11+
allow_failures:
12+
- php: hhvm
13+
14+
before_script:
15+
- curl -s http://getcomposer.org/installer | php
16+
- php composer.phar update --dev --no-interaction
17+
18+
script:
19+
- mkdir -p build/logs
20+
- php vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml
21+
22+
after_script:
23+
- wget https://scrutinizer-ci.com/ocular.phar
24+
- sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi;'

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Base64 Url Safe
2+
3+
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Spomky-Labs/base64url/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Spomky-Labs/base64url/?branch=master)
4+
[![Code Coverage](https://scrutinizer-ci.com/g/Spomky-Labs/base64url/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/Spomky-Labs/base64url/?branch=master)
5+
[![Build Status](https://scrutinizer-ci.com/g/Spomky-Labs/base64url/badges/build.png?b=master)](https://scrutinizer-ci.com/g/Spomky-Labs/base64url/build-status/master)
6+
[![HHVM Status](http://hhvm.h4cc.de/badge/Spomky-Labs/base64url.png)](http://hhvm.h4cc.de/package/Spomky-Labs/base64url)
7+
8+
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/0f8f9b12-2076-4d0e-a34e-c6f097c61b16/big.png)](https://insight.sensiolabs.com/projects/0f8f9b12-2076-4d0e-a34e-c6f097c61b16)
9+
10+
[![Latest Stable Version](https://poser.pugx.org/Spomky-Labs/base64url/v/stable.png)](https://packagist.org/packages/Spomky-Labs/base64url) [![Total Downloads](https://poser.pugx.org/Spomky-Labs/base64url/downloads.png)](https://packagist.org/packages/Spomky-Labs/base64url) [![Latest Unstable Version](https://poser.pugx.org/Spomky-Labs/base64url/v/unstable.png)](https://packagist.org/packages/Spomky-Labs/base64url) [![License](https://poser.pugx.org/Spomky-Labs/base64url/license.png)](https://packagist.org/packages/Spomky-Labs/base64url)

composer.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "spomky-labs/base64url",
3+
"description": "Base 64 URL Safe",
4+
"type": "library",
5+
"license": "MIT",
6+
"keywords": ["Base64", "URL", "Safe"],
7+
"homepage": "https://github.com/Spomky-Labs/base64url",
8+
"authors": [
9+
{
10+
"name": "Florent Morselli",
11+
"homepage": "https://github.com/Spomky-Labs/base64url/contributors"
12+
}
13+
],
14+
"autoload": {
15+
"psr-4": {
16+
"Base64Url\\": "lib/"
17+
}
18+
},
19+
"autoload-dev": {
20+
"psr-4": {
21+
"Base64Url\\": "tests/"
22+
}
23+
},
24+
"require": {
25+
"php": ">=5.3"
26+
},
27+
"extra": {
28+
"branch-alias": {
29+
"dev-master": "0.0.x-dev"
30+
}
31+
}
32+
}

lib/Base64Url.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace Base64Url;
4+
5+
/**
6+
* Encode and decode data into Base64 Url Safe
7+
*/
8+
class Base64Url
9+
{
10+
public static function encode($data)
11+
{
12+
return rtrim(strtr(base64_encode($data), '+/', '-_'), '=');
13+
}
14+
15+
public static function decode($data)
16+
{
17+
return base64_decode(strtr($data, '-_', '+/'));
18+
}
19+
}

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
3+
backupGlobals="false"
4+
strict="true"
5+
backupStaticAttributes="false"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="true"
12+
bootstrap="vendor/autoload.php"
13+
colors="true">
14+
<testsuites>
15+
<testsuite name="Test Suite">
16+
<directory suffix="Test.php">./tests</directory>
17+
</testsuite>
18+
</testsuites>
19+
20+
<filter>
21+
<whitelist>
22+
<directory suffix=".php">./</directory>
23+
<exclude>
24+
<directory>./tests</directory>
25+
<directory>./doc</directory>
26+
<directory>./vendor</directory>
27+
</exclude>
28+
</whitelist>
29+
</filter>
30+
</phpunit>

0 commit comments

Comments
 (0)