Skip to content

Commit ecf6b2b

Browse files
committed
Initial upload files
0 parents  commit ecf6b2b

12 files changed

+989
-0
lines changed

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_size = 4
6+
indent_style = space
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
phpunit.xml
2+
composer.phar
3+
composer.lock
4+
composer-test.lock
5+
vendor/
6+
build/artifacts/
7+
artifacts/
8+
docs/_build
9+
docs/*.pyc
10+
.git*/
11+
.idea
12+
.DS_STORE

CHANGELOG.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# CHANGELOG
2+
3+
## 1.0.0 - 2017-02-02
4+
* Added `Josantonius\Url\Url` class.
5+
* Added `Josantonius\Url\Url::getCurrentPage()` method.
6+
* Added `Josantonius\Url\Url::getProtocol()` method.
7+
* Added `Josantonius\Url\Url::isSSL()` method.
8+
* Added `Josantonius\Url\Url::getDomain()` method.
9+
* Added `Josantonius\Url\Url::getUri()` method.
10+
* Added `Josantonius\Url\Url::getPort()` method.
11+
* Added `Josantonius\Url\Url::addBackslash()` method.
12+
* Added `Josantonius\Url\Url::previous()` method.
13+
* Added `Josantonius\Url\Url::redirect()` method.
14+
* Added `Josantonius\Url\Url::autoLink()` method.
15+
* Added `Josantonius\Url\Url::generateSafeSlug()` method.
16+
* Added `Josantonius\Url\Url::segment()` method.
17+
* Added `Josantonius\Url\Url::getFirstSegment()` method.
18+
* Added `Josantonius\Url\Url::getLastSegment()` method.
19+
20+
## 1.0.0 - 2017-02-02
21+
* Added `Josantonius\Url\Exception\UrlException` class.
22+
* Added `Josantonius\Url\Exception\Exceptions` abstract class.
23+
* Added `Josantonius\Url\Exception\UrlException->__construct()` method.
24+
25+
## 1.0.0 - 2017-02-02
26+
* Added `Josantonius\Url\Tests\UrlTest` class.
27+
* Added `Josantonius\Url\Tests\UrlTest::testGetCurrentPage()` method.
28+
* Added `Josantonius\Url\Tests\UrlTest::testGetProtocol()` method.
29+
* Added `Josantonius\Url\Tests\UrlTest::testIsSSL()` method.
30+
* Added `Josantonius\Url\Tests\UrlTest::getDomain()` method.
31+
* Added `Josantonius\Url\Tests\UrlTest::testGetUri()` method.
32+
* Added `Josantonius\Url\Tests\UrlTest::testGetPort()` method.
33+
* Added `Josantonius\Url\Tests\UrlTest::testAddBackslash()` method.
34+
* Added `Josantonius\Url\Tests\UrlTest::testPrevious()` method.
35+
* Added `Josantonius\Url\Tests\UrlTest::testRedirect()` method.
36+
* Added `Josantonius\Url\Tests\UrlTest::testAutoLink()` method.
37+
* Added `Josantonius\Url\Tests\UrlTest::testCustomAutoLink()` method.
38+
* Added `Josantonius\Url\Tests\UrlTest::testGenerateSafeSlug()` method.
39+
* Added `Josantonius\Url\Tests\UrlTest::testSegment()` method.
40+
* Added `Josantonius\Url\Tests\UrlTest::testGetFirstSegment()` method.
41+
* Added `Josantonius\Url\Tests\UrlTest::testGetLastSegment()` method.

CONDUCT.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Contributor Code of Conduct
2+
3+
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.
4+
5+
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.
6+
7+
Examples of unacceptable behavior by participants include:
8+
9+
* The use of sexualized language or imagery
10+
* Personal attacks
11+
* Trolling or insulting/derogatory comments
12+
* Public or private harassment
13+
* Publishing other's private information, such as physical or electronic addresses, without explicit permission
14+
* Other unethical or unprofessional conduct.
15+
16+
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.
17+
18+
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.
19+
20+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
21+
22+
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/)

LICENSE

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

README-ES.md

+182
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# PHP Url library
2+
3+
[![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)
4+
5+
[Spanish version](README-ES.md)
6+
7+
Librería para manipulación de urls.
8+
9+
---
10+
11+
- [Instalación](#instalación)
12+
- [Requisitos](#requisitos)
13+
- [Cómo empezar y ejemplos](#cómo-empezar-y-ejemplos)
14+
- [Métodos disponibles](#métodos-disponibles)
15+
- [Uso](#uso)
16+
- [Tests](#tests)
17+
- [Manejador de excepciones](#manejador-de-excepciones)
18+
- [Contribuir](#contribuir)
19+
- [Repositorio](#repositorio)
20+
- [Autor](#autor)
21+
- [Licencia](#licencia)
22+
23+
---
24+
25+
### Instalación
26+
27+
La mejor forma de instalar esta extensión es a través de [composer](http://getcomposer.org/download/).
28+
29+
Para instalar PHP Url library, simplemente escribe:
30+
31+
$ composer require Josantonius/Url
32+
33+
### Requisitos
34+
35+
Esta ĺibrería es soportada por versiones de PHP 5.6 o superiores y es compatible con versiones de HHVM 3.0 o superiores.
36+
37+
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".
38+
39+
### Cómo empezar y ejemplos
40+
41+
Para utilizar esta librería, simplemente:
42+
43+
```php
44+
require __DIR__ . '/vendor/autoload.php';
45+
46+
use Josantonius\Url\Url;
47+
```
48+
### Métodos disponibles
49+
50+
Métodos disponibles en esta librería:
51+
52+
```php
53+
Url::getCurrentPage();
54+
Url::getProtocol();
55+
Url::isSSL();
56+
Url::getDomain();
57+
Url::getUri();
58+
Url::getPort();
59+
Url::addBackslash();
60+
Url::previous();
61+
Url::redirect();
62+
Url::autoLink();
63+
Url::generateSafeSlug();
64+
Url::segment();
65+
Url::getFirstSegment();
66+
Url::getLastSegment();
67+
```
68+
### Uso
69+
70+
Ejemplo de uso para esta librería:
71+
72+
```php
73+
<?php
74+
require __DIR__ . '/vendor/autoload.php';
75+
76+
use Josantonius\Url\Url;
77+
78+
print('<pre>');
79+
80+
var_dump(Url::getCurrentPage());
81+
# string(35) "http://site.com:8081/user/login/"
82+
83+
var_dump(Url::getProtocol());
84+
# string(4) "http"
85+
86+
var_dump(Url::isSSL());
87+
# bool(false)
88+
89+
var_dump(Url::getDomain());
90+
# string(9) "site.com"
91+
92+
var_dump(Url::getUri());
93+
# string(14) "/user/login/"
94+
95+
var_dump(Url::getPort());
96+
# string(4) "8081"
97+
98+
var_dump(Url::addBackslash('path/to/file'));
99+
# string(13) "path/to/file/"
100+
101+
var_dump(Url::autoLink('https://github.com'));
102+
# string(51) "<a href="https://github.com">https://github.com</a>"
103+
104+
var_dump(Url::autoLink('https://github.com', 'GitHub'));
105+
# string(39) "<a href="https://github.com">GitHub</a>"
106+
107+
var_dump(Url::generateSafeSlug('https://github.com'));
108+
# string(16) "https-github-com"
109+
110+
var_dump($segments = Url::segment());
111+
/*
112+
array(2) {
113+
[0]=>
114+
string(5) "user"
115+
[1]=>
116+
string(6) "login"
117+
}
118+
*/
119+
var_dump(Url::getFirstSegment($segments));
120+
# string(5) "user"
121+
122+
var_dump(Url::getLastSegment($segments));
123+
# string(6) "login"
124+
125+
print('</pre>');
126+
```
127+
128+
### Tests
129+
130+
Para utilizar la clase de [pruebas](tests), simplemente:
131+
132+
```php
133+
<?php
134+
$loader = require __DIR__ . '/vendor/autoload.php';
135+
136+
$loader->addPsr4('Josantonius\\Url\\Tests\\', __DIR__ . '/vendor/josantonius/url/tests');
137+
138+
use Josantonius\Url\Tests\UrlTest;
139+
```
140+
Métodos de prueba disponibles en esta librería:
141+
142+
```php
143+
UrlTest::testGetCurrentPage();
144+
UrlTest::testGetProtocol();
145+
UrlTest::testIsSSL();
146+
UrlTest::getDomain();
147+
UrlTest::testGetUri();
148+
UrlTest::testGetPort();
149+
UrlTest::testAddBackslash();
150+
UrlTest::testPrevious();
151+
UrlTest::testRedirect();
152+
UrlTest::testAutoLink();
153+
UrlTest::testCustomAutoLink();
154+
UrlTest::testGenerateSafeSlug();
155+
UrlTest::testSegment();
156+
UrlTest::testGetFirstSegment();
157+
UrlTest::testGetLastSegment();
158+
```
159+
160+
### Manejador de excepciones
161+
162+
Esta librería utiliza [control de excepciones](src/Exception) que puedes personalizar a tu gusto.
163+
### Contribuir
164+
1. Comprobar si hay incidencias abiertas o abrir una nueva para iniciar una discusión en torno a un fallo o función.
165+
1. Bifurca la rama del repositorio en GitHub para iniciar la operación de ajuste.
166+
1. Escribe una o más pruebas para la nueva característica o expón el error.
167+
1. Haz cambios en el código para implementar la característica o reparar el fallo.
168+
1. Envía pull request para fusionar los cambios y que sean publicados.
169+
170+
Esto está pensado para proyectos grandes y de larga duración.
171+
172+
### Repositorio
173+
174+
Los archivos de este repositorio se crearon y subieron automáticamente con [Reposgit Creator](https://github.com/Josantonius/BASH-Reposgit).
175+
176+
### Autor
177+
178+
Mantenido por [Josantonius](https://github.com/Josantonius/).
179+
180+
### Licencia
181+
182+
Este proyecto está licenciado bajo la **licencia MIT**. Consulta el archivo [LICENSE](LICENSE) para más información.

0 commit comments

Comments
 (0)