1. Go to this page and download the library: Download se7enxweb/prime 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/ */
se7enxweb / prime example snippets
namespace AppBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class BlogController extends Controller
{
public function showAction(Request $request, string $slug)
{
$post = $this->getDoctrine()
->getRepository('AppBundle:Post')
->findOneBy(['slug' => $slug]);
if (!$post) {
throw $this->createNotFoundException('Post not found');
}
return $this->render('blog/show.html.twig', ['post' => $post]);
}
}
// app/AppKernel.php
public function registerBundles(): array
{
$bundles = [
// … core bundles …
new Acme\BlogBundle\AcmeBlogBundle(),
];
return $bundles;
}
namespace Acme\BlogBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
class BlogController extends Controller
{
public function indexAction(): Response
{
$posts = $this->get('acme_blog.post_manager')->findLatest(10);
return $this->render('@AcmeBlog/Blog/index.html.twig', ['posts' => $posts]);
}
}
// Old style — PHPUnit 4–9 docblock annotations (still parsed but deprecated)
/**
* @dataProvider valuesProvider
* @group integration
*/
public function testProcess($input, $expected): void {}
// PHPUnit 11 style — PHP 8 native attributes (preferred)
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Group;
#[DataProvider('valuesProvider')]
#[Group('integration')]
public function testProcess($input, $expected): void {}
// src/AppBundle/Tests/Service/SluggerTest.php
namespace AppBundle\Tests\Service;
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;
class SluggerTest extends TestCase
{
#[DataProvider('slugProvider')]
public function testSlugify(string $input, string $expected): void
{
$slug = trim(strtolower(preg_replace('/[^a-z0-9]+/i', '-', $input)), '-');
$this->assertSame($expected, $slug);
}
public static function slugProvider(): array
{
return [
['Hello World!', 'hello-world'],
['7x Prime 2.9', '7x-prime-2-9'],
['', ''],
];
}
}
src/Symfony/Component/MyComponent/
├── MyService.php
└── Tests/
├── MyServiceTest.php ← unit tests for MyService
└── Fixtures/
└── MyFixture.php ← test fixtures (no test logic)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.