Skip to content

Commit

Permalink
Initial upload files
Browse files Browse the repository at this point in the history
  • Loading branch information
josantonius committed Feb 2, 2017
0 parents commit ecf6b2b
Show file tree
Hide file tree
Showing 12 changed files with 989 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
phpunit.xml
composer.phar
composer.lock
composer-test.lock
vendor/
build/artifacts/
artifacts/
docs/_build
docs/*.pyc
.git*/
.idea
.DS_STORE
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# CHANGELOG

## 1.0.0 - 2017-02-02
* Added `Josantonius\Url\Url` class.
* Added `Josantonius\Url\Url::getCurrentPage()` method.
* Added `Josantonius\Url\Url::getProtocol()` method.
* Added `Josantonius\Url\Url::isSSL()` method.
* Added `Josantonius\Url\Url::getDomain()` method.
* Added `Josantonius\Url\Url::getUri()` method.
* Added `Josantonius\Url\Url::getPort()` method.
* Added `Josantonius\Url\Url::addBackslash()` method.
* Added `Josantonius\Url\Url::previous()` method.
* Added `Josantonius\Url\Url::redirect()` method.
* Added `Josantonius\Url\Url::autoLink()` method.
* Added `Josantonius\Url\Url::generateSafeSlug()` method.
* Added `Josantonius\Url\Url::segment()` method.
* Added `Josantonius\Url\Url::getFirstSegment()` method.
* Added `Josantonius\Url\Url::getLastSegment()` method.

## 1.0.0 - 2017-02-02
* Added `Josantonius\Url\Exception\UrlException` class.
* Added `Josantonius\Url\Exception\Exceptions` abstract class.
* Added `Josantonius\Url\Exception\UrlException->__construct()` method.

## 1.0.0 - 2017-02-02
* Added `Josantonius\Url\Tests\UrlTest` class.
* Added `Josantonius\Url\Tests\UrlTest::testGetCurrentPage()` method.
* Added `Josantonius\Url\Tests\UrlTest::testGetProtocol()` method.
* Added `Josantonius\Url\Tests\UrlTest::testIsSSL()` method.
* Added `Josantonius\Url\Tests\UrlTest::getDomain()` method.
* Added `Josantonius\Url\Tests\UrlTest::testGetUri()` method.
* Added `Josantonius\Url\Tests\UrlTest::testGetPort()` method.
* Added `Josantonius\Url\Tests\UrlTest::testAddBackslash()` method.
* Added `Josantonius\Url\Tests\UrlTest::testPrevious()` method.
* Added `Josantonius\Url\Tests\UrlTest::testRedirect()` method.
* Added `Josantonius\Url\Tests\UrlTest::testAutoLink()` method.
* Added `Josantonius\Url\Tests\UrlTest::testCustomAutoLink()` method.
* Added `Josantonius\Url\Tests\UrlTest::testGenerateSafeSlug()` method.
* Added `Josantonius\Url\Tests\UrlTest::testSegment()` method.
* Added `Josantonius\Url\Tests\UrlTest::testGetFirstSegment()` method.
* Added `Josantonius\Url\Tests\UrlTest::testGetLastSegment()` method.
22 changes: 22 additions & 0 deletions CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
* Other unethical or unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.

This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community in a direct capacity. Personal views, beliefs and values of individuals do not necessarily reflect those of the organisation or affiliated individuals and organisations.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/)
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)
=====================

Copyright (c) `2017` `Josantonius, https://github.com/Josantonius <[email protected]>`

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
182 changes: 182 additions & 0 deletions README-ES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# PHP Url library

[![Latest Stable Version](https://poser.pugx.org/josantonius/url/v/stable)](https://packagist.org/packages/josantonius/url) [![Total Downloads](https://poser.pugx.org/josantonius/url/downloads)](https://packagist.org/packages/josantonius/url) [![Latest Unstable Version](https://poser.pugx.org/josantonius/url/v/unstable)](https://packagist.org/packages/josantonius/url) [![License](https://poser.pugx.org/josantonius/url/license)](https://packagist.org/packages/josantonius/url)

[Spanish version](README-ES.md)

Librería para manipulación de urls.

---

- [Instalación](#instalación)
- [Requisitos](#requisitos)
- [Cómo empezar y ejemplos](#cómo-empezar-y-ejemplos)
- [Métodos disponibles](#métodos-disponibles)
- [Uso](#uso)
- [Tests](#tests)
- [Manejador de excepciones](#manejador-de-excepciones)
- [Contribuir](#contribuir)
- [Repositorio](#repositorio)
- [Autor](#autor)
- [Licencia](#licencia)

---

### Instalación

La mejor forma de instalar esta extensión es a través de [composer](http://getcomposer.org/download/).

Para instalar PHP Url library, simplemente escribe:

$ composer require Josantonius/Url

### Requisitos

Esta ĺibrería es soportada por versiones de PHP 5.6 o superiores y es compatible con versiones de HHVM 3.0 o superiores.

Para utilizar esta librería en HHVM (HipHop Virtual Machine) tendrás que activar los tipos escalares. Añade la siguiente ĺínea "hhvm.php7.scalar_types = true" en tu "/etc/hhvm/php.ini".

### Cómo empezar y ejemplos

Para utilizar esta librería, simplemente:

```php
require __DIR__ . '/vendor/autoload.php';

use Josantonius\Url\Url;
```
### Métodos disponibles

Métodos disponibles en esta librería:

```php
Url::getCurrentPage();
Url::getProtocol();
Url::isSSL();
Url::getDomain();
Url::getUri();
Url::getPort();
Url::addBackslash();
Url::previous();
Url::redirect();
Url::autoLink();
Url::generateSafeSlug();
Url::segment();
Url::getFirstSegment();
Url::getLastSegment();
```
### Uso

Ejemplo de uso para esta librería:

```php
<?php
require __DIR__ . '/vendor/autoload.php';

use Josantonius\Url\Url;

print('<pre>');

var_dump(Url::getCurrentPage());
# string(35) "http://site.com:8081/user/login/"

var_dump(Url::getProtocol());
# string(4) "http"

var_dump(Url::isSSL());
# bool(false)

var_dump(Url::getDomain());
# string(9) "site.com"

var_dump(Url::getUri());
# string(14) "/user/login/"

var_dump(Url::getPort());
# string(4) "8081"

var_dump(Url::addBackslash('path/to/file'));
# string(13) "path/to/file/"

var_dump(Url::autoLink('https://github.com'));
# string(51) "<a href="https://github.com">https://github.com</a>"

var_dump(Url::autoLink('https://github.com', 'GitHub'));
# string(39) "<a href="https://github.com">GitHub</a>"

var_dump(Url::generateSafeSlug('https://github.com'));
# string(16) "https-github-com"

var_dump($segments = Url::segment());
/*
array(2) {
[0]=>
string(5) "user"
[1]=>
string(6) "login"
}
*/
var_dump(Url::getFirstSegment($segments));
# string(5) "user"

var_dump(Url::getLastSegment($segments));
# string(6) "login"

print('</pre>');
```

### Tests

Para utilizar la clase de [pruebas](tests), simplemente:

```php
<?php
$loader = require __DIR__ . '/vendor/autoload.php';

$loader->addPsr4('Josantonius\\Url\\Tests\\', __DIR__ . '/vendor/josantonius/url/tests');

use Josantonius\Url\Tests\UrlTest;
```
Métodos de prueba disponibles en esta librería:

```php
UrlTest::testGetCurrentPage();
UrlTest::testGetProtocol();
UrlTest::testIsSSL();
UrlTest::getDomain();
UrlTest::testGetUri();
UrlTest::testGetPort();
UrlTest::testAddBackslash();
UrlTest::testPrevious();
UrlTest::testRedirect();
UrlTest::testAutoLink();
UrlTest::testCustomAutoLink();
UrlTest::testGenerateSafeSlug();
UrlTest::testSegment();
UrlTest::testGetFirstSegment();
UrlTest::testGetLastSegment();
```

### Manejador de excepciones

Esta librería utiliza [control de excepciones](src/Exception) que puedes personalizar a tu gusto.
### Contribuir
1. Comprobar si hay incidencias abiertas o abrir una nueva para iniciar una discusión en torno a un fallo o función.
1. Bifurca la rama del repositorio en GitHub para iniciar la operación de ajuste.
1. Escribe una o más pruebas para la nueva característica o expón el error.
1. Haz cambios en el código para implementar la característica o reparar el fallo.
1. Envía pull request para fusionar los cambios y que sean publicados.

Esto está pensado para proyectos grandes y de larga duración.

### Repositorio

Los archivos de este repositorio se crearon y subieron automáticamente con [Reposgit Creator](https://github.com/Josantonius/BASH-Reposgit).

### Autor

Mantenido por [Josantonius](https://github.com/Josantonius/).

### Licencia

Este proyecto está licenciado bajo la **licencia MIT**. Consulta el archivo [LICENSE](LICENSE) para más información.
Loading

0 comments on commit ecf6b2b

Please sign in to comment.