ekoh / blog-posts
A simple blog package in php
dev-master
2023-06-05 07:45 UTC
Requires
- php: ^7.0
Requires (Dev)
- fakerphp/faker: ^1.17
- pestphp/pest: ^1.21
This package is not auto-updated.
Last update: 2024-10-20 23:31:16 UTC
README
#Blog Posts Package
A simple blog posts package in PHP used for teaching package development in PHP on my free youtube course.
##installation
To install this package, use composer
composer require ekoh/blog-posts
##Usage
$blog = Blog::getInstance(); $postArray = [ 'id' => 1, 'Title' => 'Post title', 'image' => 'Path/to/image (optional)', 'body' => 'post body', 'author' => 'author', 'hidden' => 0, 'comments' => [] ]; $blog->addPost($postArray); $blog->getPosts($offset, $limit); $blog->editPost($postId, $postArray); $blog->getPost($postId); $post = new Post($postId); $commentArray = [ 'body' => 'post comment', 'author' => 'optional' ]; $post->addComment($commentArray); $post->getComments($offset, $limit); $post->editComment($commentId, $commentArray);