PHP code example of anomaly / blog-module

1. Go to this page and download the library: Download anomaly/blog-module 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/ */

    

anomaly / blog-module example snippets


use Anomaly\PostsModule\Post\Contract\PostRepositoryInterface;

$posts = app(PostRepositoryInterface::class);

// Get all posts
$allPosts = $posts->all();

// Get published posts
$published = $posts->findAllPublished();

// Get post by slug
$post = $posts->findBySlug('my-article');

// Get posts by category
$posts = $posts->findByCategory($category);