Compare commits

..
8 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
eorozco ef6c0b7940 Bump abandoned recommendation 2024-05-22 16:04:24 -06:00
eorozco b524ca017f Vendor name compatibility 2024-05-22 15:21:09 -06:00
eorozco 121152213a Vendor name change 2024-05-22 14:57:01 -06:00
edgar-orozco d26fe4d8c7 Merge pull request #1 from ImprovingLaborCourts/enhancement/laravel-11-support
Bump dependencies for Laravel 11
2024-05-22 14:22:44 -06:00
eorozco ec5437ff6d Bump dependencies for Laravel 11 2024-05-22 14:16:29 -06:00
Matt Lantz cb9092527e Update readme.md 2023-09-01 11:34:19 -04:00
10 changed files with 150 additions and 47 deletions

No files matched your search

+4 -5
View File
@@ -1,6 +1,5 @@
/vendor vendor/
composer.phar
composer.lock composer.lock
.DS_Store .phpunit.cache/
Thumbs.db .phpunit.result.cache
.idea .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.
+15 -18
View File
@@ -1,11 +1,11 @@
{ {
"name": "laravelcollective/html", "name": "improving-labor-courts/html",
"description": "HTML and Form Builders for the Laravel Framework", "description": "HTML and Form Builders for the Laravel Framework",
"version": "7.0.0",
"license": "MIT", "license": "MIT",
"homepage": "https://laravelcollective.com",
"support": { "support": {
"issues": "https://github.com/LaravelCollective/html/issues", "issues": "https://git.ilj.mx/ILJ/html/issues",
"source": "https://github.com/LaravelCollective/html" "source": "https://git.ilj.mx/ILJ/html"
}, },
"authors": [ "authors": [
{ {
@@ -18,17 +18,17 @@
} }
], ],
"require": { "require": {
"php": ">=7.2.5", "php": "^8.2",
"illuminate/http": "^6.0|^7.0|^8.0|^9.0|^10.0", "illuminate/http": "^11.0|^12.0|^13.0",
"illuminate/routing": "^6.0|^7.0|^8.0|^9.0|^10.0", "illuminate/routing": "^11.0|^12.0|^13.0",
"illuminate/session": "^6.0|^7.0|^8.0|^9.0|^10.0", "illuminate/session": "^11.0|^12.0|^13.0",
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0", "illuminate/support": "^11.0|^12.0|^13.0",
"illuminate/view": "^6.0|^7.0|^8.0|^9.0|^10.0" "illuminate/view": "^11.0|^12.0|^13.0"
}, },
"require-dev": { "require-dev": {
"illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0", "illuminate/database": "^11.0|^12.0|^13.0",
"mockery/mockery": "~1.0", "mockery/mockery": "^1.6",
"phpunit/phpunit": "~8.5|^9.5.10" "phpunit/phpunit": "^10.5|^11.5|^12.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
@@ -40,7 +40,7 @@
}, },
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "6.x-dev" "dev-7.x": "7.x-dev"
}, },
"laravel": { "laravel": {
"providers": [ "providers": [
@@ -51,8 +51,5 @@
"Html": "Collective\\Html\\HtmlFacade" "Html": "Collective\\Html\\HtmlFacade"
} }
} }
}, }
"minimum-stability": "dev",
"abandoned": "spatie/laravel-html",
"prefer-stable": true
} }
+10 -14
View File
@@ -1,24 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false" <phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupStaticAttributes="false" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="phpunit.php" bootstrap="phpunit.php"
colors="true" colors="true"
convertErrorsToExceptions="true" displayDetailsOnTestsThatTriggerDeprecations="true"
convertNoticesToExceptions="true" displayDetailsOnTestsThatTriggerWarnings="true"
convertWarningsToExceptions="true" failOnDeprecation="true"
processIsolation="false" failOnWarning="true">
stopOnError="false"
stopOnFailure="false"
verbose="true"
>
<testsuites> <testsuites>
<testsuite name="Laravel Html Test Suite"> <testsuite name="Laravel Html Test Suite">
<directory suffix="Test.php">./tests</directory> <directory suffix="Test.php">./tests</directory>
</testsuite> </testsuite>
</testsuites> </testsuites>
<filter> <source>
<whitelist processUncoveredFilesFromWhitelist="true"> <include>
<directory suffix=".php">./src</directory> <directory suffix=".php">./src</directory>
</whitelist> </include>
</filter> </source>
</phpunit> </phpunit>
+20 -5
View File
@@ -1,9 +1,24 @@
![LaravelCollective HTML](LaravelCollectiveHTML-banner.png) ![LaravelCollective HTML](LaravelCollectiveHTML-banner.png)
[![Build Status](https://travis-ci.org/LaravelCollective/html.svg)](https://travis-ci.org/LaravelCollective/html) ## Fork mantenido por ILJ
[![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) 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.
[![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) 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. Official documentation for Forms & Html for The Laravel Framework can be found at the [LaravelCollective](https://laravelcollective.com/docs) website.
## Replacement
If you're looking to replace this package due to it's retirement we recommend using [Shift](https://laravelshift.com/convert-laravelcollective-html-to-spatie-laravel-html)
+32 -4
View File
@@ -10,6 +10,7 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull; use Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Carbon;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
use Illuminate\Support\Traits\Macroable; use Illuminate\Support\Traits\Macroable;
@@ -116,7 +117,7 @@ class FormBuilder
* @param string $csrfToken * @param string $csrfToken
* @param Request $request * @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->url = $url;
$this->html = $html; $this->html = $html;
@@ -709,21 +710,48 @@ class FormBuilder
* @param string $name * @param string $name
* @param string $selected * @param string $selected
* @param array $options * @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 * @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 = []; $months = [];
foreach (range(1, 12) as $month) { 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); 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. * 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\Routing\UrlGenerator $url
* @param \Illuminate\Contracts\View\Factory $view * @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->url = $url;
$this->view = $view; $this->view = $view;
+7
View File
@@ -14,6 +14,13 @@ use Mockery as m;
class FormAccessibleTest extends PHPUnit\Framework\TestCase class FormAccessibleTest extends PHPUnit\Framework\TestCase
{ {
protected $formBuilder;
protected $htmlBuilder;
protected $modelData;
protected $now;
protected $urlGenerator;
protected $viewFactory;
protected function setUp(): void protected function setUp(): void
{ {
Capsule::table('models')->truncate(); Capsule::table('models')->truncate();
+36
View File
@@ -14,6 +14,10 @@ use Mockery as m;
class FormBuilderTest extends PHPUnit\Framework\TestCase class FormBuilderTest extends PHPUnit\Framework\TestCase
{ {
protected $htmlBuilder;
protected $urlGenerator;
protected $viewFactory;
/** /**
* @var FormBuilder * @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); $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() public function testFormCheckbox()
{ {
$this->formBuilder->setSessionStore($session = m::mock('Illuminate\Contracts\Session\Session')); $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 class HtmlBuilderTest extends PHPUnit\Framework\TestCase
{ {
protected $htmlBuilder;
protected $urlGenerator;
protected $viewFactory;
/** /**
* Setup the test environment. * Setup the test environment.