1. Go to this page and download the library: Download marrow/framework 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/ */
marrow / framework example snippets
use Marrow\Attributes\Inject;
use Marrow\Events\Dispatcher;
class PostService
{
public function __construct(
private readonly PostRepository $posts,
private readonly Dispatcher $events,
#[Inject('config.app.name')] private readonly string $appName,
) {
}
}
use Marrow\Module\Attributes\Module;
use Marrow\Module\BaseModule;
#[Module(
name: 'blog',
imports: [AuthModule::class],
providers: [PostService::class],
exports: [PostService::class],
listeners: [
PostPublished::class => [SendNewsletterListener::class],
],
)]
class BlogModule extends BaseModule
{
}
$router->group(['prefix' => '/admin', 'middleware' => ['auth']], function () use ($router) {
$router->get('/posts', [PostController::class, 'index'])->name('posts.index');
$router->post('/posts', [PostController::class, 'store'])->name('posts.store');
});