-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The repository was updated to version 1.1.1
- Loading branch information
1 parent
297f921
commit 500c564
Showing
9 changed files
with
728 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# CHANGELOG | ||
|
||
## 1.1.1 - 2017-03-18 | ||
* Some files were excluded from download and comments and readme files were updated. | ||
|
||
## 1.1.0 - 2017-02-28 | ||
* Added `Josantonius\Url\Url::getBaseUrl()` method. | ||
|
||
## 1.1.0 - 2017-02-28 | ||
* Added `Josantonius\Url\Tests\UrlTest::testGetBaseUrl()` method. | ||
|
||
## 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::getUriMethods()` 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
# 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) | ||
|
||
[English version](README.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) | ||
- [Licencia](#licencia) | ||
- [Copyright](#copyright) | ||
|
||
--- | ||
|
||
### 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 | ||
|
||
El comando anterior solamente instalará los archivos necesarios, si prefieres descargar todo el código, incluyendo tests, puedes utilizar: | ||
|
||
$ composer require Josantonius/Url --prefer-source | ||
|
||
También puedes clonar el repositorio completo con Git: | ||
|
||
$ git clone https://github.com/Josantonius/PHP-Url.git | ||
|
||
### 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. | ||
|
||
### 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::getUriMethods(); | ||
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::testGetUriMethods(); | ||
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). | ||
|
||
### Licencia | ||
|
||
Este proyecto está licenciado bajo **licencia MIT**. Consulta el archivo [LICENSE](LICENSE) para más información. | ||
|
||
### Copyright | ||
|
||
2017 Josantonius, [josantonius.com](https://josantonius.com/) | ||
|
||
Si te ha resultado útil, házmelo saber :wink: | ||
|
||
Puedes contactarme en [Twitter](https://twitter.com/Josantonius) o a través de mi [correo electrónico](mailto:[email protected]). |
Oops, something went wrong.