PHP code example of mwebbers / laravel-code-commons
1. Go to this page and download the library: Download mwebbers/laravel-code-commons library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Mwebbers\LaravelCodeCommons\Livewire\Concerns\WithCollectionSorting;
class Tickets extends Component
{
use WithCollectionSorting;
public function render()
{
$rows = $this->sortedBy($this->tickets(), [
'title' => fn ($t) => $t->title,
'deadline' => fn ($t) => $t->deadline?->getTimestamp() ?? PHP_INT_MAX,
]);
// ...
}
}
use Mwebbers\LaravelCodeCommons\Testing\ScopeCoverage;
use PHPUnit\Framework\TestCase;
final class ScopeCoverageTest extends TestCase
{
public function test_scope_and_tests_stay_in_sync(): void
{
$coverage = new ScopeCoverage(dirname(__DIR__, 2).'/SCOPE.md', dirname(__DIR__, 2).'/tests');
$result = $coverage->mismatch(__FILE__);
$this->assertSame([], $result['missing'], 'SCOPE features with no test: '.implode(', ', $result['missing']));
$this->assertSame([], $result['stale'], 'Test groups for unknown features: '.implode(', ', $result['stale']));
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.