Compare commits

...
2 Commits
Author SHA1 Message Date
eorozco 7c8d85cb28 [RELEASE] v7.0.0 2026-11-26 15:45:50 -06:00
eorozco 596d90d940 feat: soporte para Laravel 12 y Laravel 13
- Requisitos: PHP 8.2 o superior e illuminate 11, 12 o 13.
- selectMonth usa Carbon isoFormat en lugar de strftime, deprecada desde PHP 8.1; acepta los formatos anteriores y respeta el locale de la aplicación.
- Nulos explícitos en los constructores de HtmlBuilder y FormBuilder para PHP 8.4.
- Pruebas para PHPUnit 10.5, 11.5 y 12, con propiedades declaradas y sin avisos de deprecación.
- Readme con instrucciones para instalar desde el registro Composer de git.ilj.mx.
2026-11-26 15:45:50 -06:00
10 changed files with 146 additions and 44 deletions

No files matched your search

+4 -5
View File
@@ -1,6 +1,5 @@
/vendor
composer.phar
vendor/
composer.lock
.DS_Store
Thumbs.db
.idea
.phpunit.cache/
.phpunit.result.cache
.tools/
+21
View File
@@ -0,0 +1,21 @@
# Changelog
## [7.0.0] - 2026-11-26
### Added
- Soporte para Laravel 12 y Laravel 13.
- `Form::selectMonth()` acepta formatos ISO de Carbon (`MMMM`, `MMM`, `MM`) y nombra los meses según el locale de la aplicación.
### Changed
- Requiere PHP 8.2 o superior y Laravel 11, 12 o 13.
- `Form::selectMonth()` usa `Carbon::isoFormat()` en lugar de `strftime()`, que está deprecada desde PHP 8.1. Los formatos anteriores `%B`, `%b`, `%h` y `%m` se siguen aceptando.
- Nulos explícitos en los constructores de `HtmlBuilder` y `FormBuilder` para no generar avisos en PHP 8.4.
- Pruebas actualizadas a PHPUnit 10.5, 11.5 y 12, y verificadas en PHP 8.2, 8.3 y 8.4.
### Removed
- Soporte para Laravel 6 a 10 y para PHP anterior a 8.2.
## [6.5.1] - 2024-05-22
### Changed
- Nombre de proveedor `improving-labor-courts/html`.
## [6.5.0] - 2024-05-22
### Added
- Soporte para Laravel 11.
+14 -15
View File
@@ -1,10 +1,11 @@
{
"name": "improving-labor-courts/html",
"description": "HTML and Form Builders for the Laravel Framework",
"version": "7.0.0",
"license": "MIT",
"support": {
"issues": "https://github.com/ImprovingLaborCourts/html/issues",
"source": "https://github.com/ImprovingLaborCourts/html"
"issues": "https://git.ilj.mx/ILJ/html/issues",
"source": "https://git.ilj.mx/ILJ/html"
},
"authors": [
{
@@ -17,17 +18,17 @@
}
],
"require": {
"php": ">=7.2.5",
"illuminate/http": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"illuminate/routing": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"illuminate/session": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"illuminate/view": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0"
"php": "^8.2",
"illuminate/http": "^11.0|^12.0|^13.0",
"illuminate/routing": "^11.0|^12.0|^13.0",
"illuminate/session": "^11.0|^12.0|^13.0",
"illuminate/support": "^11.0|^12.0|^13.0",
"illuminate/view": "^11.0|^12.0|^13.0"
},
"require-dev": {
"illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~8.5|^9.5.10"
"illuminate/database": "^11.0|^12.0|^13.0",
"mockery/mockery": "^1.6",
"phpunit/phpunit": "^10.5|^11.5|^12.0"
},
"autoload": {
"psr-4": {
@@ -39,7 +40,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "6.x-dev"
"dev-7.x": "7.x-dev"
},
"laravel": {
"providers": [
@@ -50,7 +51,5 @@
"Html": "Collective\\Html\\HtmlFacade"
}
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
}
+10 -14
View File
@@ -1,24 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="phpunit.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
>
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerWarnings="true"
failOnDeprecation="true"
failOnWarning="true">
<testsuites>
<testsuite name="Laravel Html Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<source>
<include>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</include>
</source>
</phpunit>
+17 -5
View File
@@ -1,10 +1,22 @@
![LaravelCollective HTML](LaravelCollectiveHTML-banner.png)
[![Build Status](https://travis-ci.org/LaravelCollective/html.svg)](https://travis-ci.org/LaravelCollective/html)
[![Total Downloads](https://poser.pugx.org/LaravelCollective/html/downloads)](https://packagist.org/packages/laravelcollective/html)
[![Latest Stable Version](https://poser.pugx.org/LaravelCollective/html/v/stable.svg)](https://packagist.org/packages/laravelcollective/html)
[![Latest Unstable Version](https://poser.pugx.org/LaravelCollective/html/v/unstable.svg)](https://packagist.org/packages/laravelcollective/html)
[![License](https://poser.pugx.org/LaravelCollective/html/license.svg)](https://packagist.org/packages/laravelcollective/html)
## Fork mantenido por ILJ
Este paquete es un fork de `laravelcollective/html`, que dejó de mantenerse en Laravel 10. Aquí se mantiene compatible con **Laravel 11, 12 y 13** (PHP 8.2 o superior), con el mismo espacio de nombres `Collective\Html` y las mismas facades `Form` y `Html`, así que basta con cambiar la dependencia.
Se publica en el registro Composer de [git.ilj.mx](https://git.ilj.mx/ilj-oss/html); no requiere token:
```json
"repositories": [
{ "type": "composer", "url": "https://git.ilj.mx/api/packages/ilj-oss/composer" }
]
```
```bash
composer require improving-labor-courts/html:^7.0
```
Los cambios de cada versión están en [CHANGELOG.md](CHANGELOG.md).
Official documentation for Forms & Html for The Laravel Framework can be found at the [LaravelCollective](https://laravelcollective.com/docs) website.
+32 -4
View File
@@ -10,6 +10,7 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection;
use Illuminate\Support\HtmlString;
use Illuminate\Support\Traits\Macroable;
@@ -116,7 +117,7 @@ class FormBuilder
* @param string $csrfToken
* @param Request $request
*/
public function __construct(HtmlBuilder $html, UrlGenerator $url, Factory $view, $csrfToken, Request $request = null)
public function __construct(HtmlBuilder $html, UrlGenerator $url, Factory $view, $csrfToken, ?Request $request = null)
{
$this->url = $url;
$this->html = $html;
@@ -709,21 +710,48 @@ class FormBuilder
* @param string $name
* @param string $selected
* @param array $options
* @param string $format
* @param string $format ISO format for Carbon::isoFormat() (e.g. "MMMM").
* Legacy strftime() month tokens (%B, %b, %h, %m) are
* still accepted and translated.
*
* @return \Illuminate\Support\HtmlString
*/
public function selectMonth($name, $selected = null, $options = [], $format = '%B')
public function selectMonth($name, $selected = null, $options = [], $format = 'MMMM')
{
$format = $this->strftimeToIsoFormat($format);
$months = [];
foreach (range(1, 12) as $month) {
$months[$month] = strftime($format, mktime(0, 0, 0, $month, 1));
$months[$month] = Carbon::create(2000, $month, 1)->isoFormat($format);
}
return $this->select($name, $months, $selected, $options);
}
/**
* Translate the strftime() month tokens accepted before 7.0 into
* Carbon ISO tokens, so existing selectMonth() calls keep working.
*
* @param string $format
*
* @return string
*/
protected function strftimeToIsoFormat($format)
{
if (strpos($format, '%') === false) {
return $format;
}
return strtr($format, [
'%B' => 'MMMM',
'%b' => 'MMM',
'%h' => 'MMM',
'%m' => 'MM',
'%%' => '%',
]);
}
/**
* Get the select option for the given value.
*
+1 -1
View File
@@ -35,7 +35,7 @@ class HtmlBuilder
* @param \Illuminate\Contracts\Routing\UrlGenerator $url
* @param \Illuminate\Contracts\View\Factory $view
*/
public function __construct(UrlGenerator $url = null, Factory $view)
public function __construct(?UrlGenerator $url, Factory $view)
{
$this->url = $url;
$this->view = $view;
+7
View File
@@ -14,6 +14,13 @@ use Mockery as m;
class FormAccessibleTest extends PHPUnit\Framework\TestCase
{
protected $formBuilder;
protected $htmlBuilder;
protected $modelData;
protected $now;
protected $urlGenerator;
protected $viewFactory;
protected function setUp(): void
{
Capsule::table('models')->truncate();
+36
View File
@@ -14,6 +14,10 @@ use Mockery as m;
class FormBuilderTest extends PHPUnit\Framework\TestCase
{
protected $htmlBuilder;
protected $urlGenerator;
protected $viewFactory;
/**
* @var FormBuilder
*/
@@ -697,6 +701,38 @@ class FormBuilderTest extends PHPUnit\Framework\TestCase
$this->assertStringContainsString('<select id="foo" name="month"><option value="1">January</option>', $month3);
}
public function testFormSelectMonthAcceptsLegacyStrftimeFormats()
{
$long = (string) $this->formBuilder->selectMonth('month', null, [], '%B');
$short = (string) $this->formBuilder->selectMonth('month', null, [], '%b');
$numeric = (string) $this->formBuilder->selectMonth('month', null, [], '%m');
$this->assertStringContainsString('<option value="1">January</option>', $long);
$this->assertStringContainsString('<option value="2">Feb</option>', $short);
$this->assertStringContainsString('<option value="12">12</option>', $numeric);
}
public function testFormSelectMonthAcceptsIsoFormats()
{
$short = (string) $this->formBuilder->selectMonth('month', null, [], 'MMM');
$this->assertStringContainsString('<option value="3">Mar</option>', $short);
}
public function testFormSelectMonthFollowsCarbonLocale()
{
$previous = \Illuminate\Support\Carbon::getLocale();
\Illuminate\Support\Carbon::setLocale('es');
try {
$months = (string) $this->formBuilder->selectMonth('month');
} finally {
\Illuminate\Support\Carbon::setLocale($previous);
}
$this->assertStringContainsString('<option value="1">enero</option>', $months);
}
public function testFormCheckbox()
{
$this->formBuilder->setSessionStore($session = m::mock('Illuminate\Contracts\Session\Session'));
+4
View File
@@ -9,6 +9,10 @@ use Mockery as m;
class HtmlBuilderTest extends PHPUnit\Framework\TestCase
{
protected $htmlBuilder;
protected $urlGenerator;
protected $viewFactory;
/**
* Setup the test environment.