Laravel Blog Package. Easiest way to add a blog to your Laravel website. A package which adds wordpress functionality to your website and is compatible with laravel 8.

Overview

Laravel Blog

Have you worked with Wordpress? Developers call this package wordpress-like laravel blog.

Give our package a Star to support us 😍

Installation Video - Less than 5 Minutes

Laravel Blog Package

Lightweight and Comprehensive

Incredible features with a lightweight laravel blog package. I highly recommend it because:

  • Quick installation (<3 minutes)
  • It's very easy to extend
  • Included great features out-of-box
  • Its simplicity allows to be easily made compatible with latest laravel
  • No additional concept except laravel knowledge
  • Compatible with other Laravel platforms like Bagisto

Outstanding Features

  • Fulltext Search - search throughout all blog posts
  • Multi Level Category - nested sets using Baum
  • Multi Language Support

Quick and easy installation (Multi-lang version)

1- Install via composer

composer require binshops/laravel-blog

For a fresh Laravel installation run the following too:

composer require laravel/ui
php artisan ui vue --auth

2- Run the following two commands to copy config file, migration files, and view files

php artisan vendor:publish --provider="BinshopsBlog\BinshopsBlogServiceProvider"

3- Execute migrations to create tables

php artisan migrate;

4- You must add one method to your \App\User (in laravel 8 \App\Models\User) model. As the name of this method shows it determines which user can manage posts. Place your logic there

 /**
     * Enter your own logic (e.g. if ($this->id === 1) to
     *   enable this user to be able to add/edit blog posts
     *
     * @return bool - true = they can edit / manage blog posts,
     *        false = they have no access to the blog admin panel
     */
    public function canManageBinshopsBlogPosts()
    {
        // Enter the logic needed for your app.
        // Maybe you can just hardcode in a user id that you
        //   know is always an admin ID?

        if (       $this->id === 1
             && $this->email === "your_admin_user@your_site.com"
           ){

           // return true so this user CAN edit/post/delete
           // blog posts (and post any HTML/JS)

           return true;
        }

        // otherwise return false, so they have no access
        // to the admin panel (but can still view posts)

        return false;
    }

5- Create a directory in public/ named blog_images

6- Login as admin and setup your package: /blog_admin/setup

Congrats! Your blog is ready to use. (URLs are customizable in the config file)

Admin panel URI: /blog_admin Front URI: /en/blog

To see package on Packagist click this Link

Single Language Version

To install the single language version of the package use version v8.1x:

1- composer require binshops/laravel-blog:v8.1.2

2- php artisan vendor:publish --provider="BinshopsBlog\BinshopsBlogServiceProvider"

3- php artisan vendor:publish --tag=laravel-fulltext

4- php artisan migrate;

You can see the single version in "single-lang" branch.

Important Notes

  • For laravel 8.x's default auth User model, change user model in binshopsblog.php to: \App\Models\User::class

Features

  • Compatible with latest laravel version (laravel 8.x)
  • Backward-compatibility with previous laravel versions
  • Full text search - searching throughout the blog posts
  • Multi-level category support
  • fully configurable via its config/binshopsblog.php config file
  • Ready to use admin panel
  • Full customizability of admin views and front views
  • Paginated views
  • Ability to upload images
  • Managing posts, categories
  • Managing comments and comment approval
  • Other options include using Disqus comments or disabling comments

Recent Changes

  • 9.1.x Multi language support
  • 8.0.x Compatibility with Laravel 8.x

What/who this package is for:

  • For websites running Laravel
  • Who wants to have a site blog. This laravel blog gives an easy to use interface to write blog posts/assign categories/manage existing posts
  • Where only admin users can edit/manage the blog (this is not suitable for every user on your site to be able to manage posts)
  • For anyone who likes to add a wordpress-like laravel blog to laravel website

How to customise the blog views/templates

After doing the correct vendor:publish, all of the default template files will be found in /resources/views/vendor/binshopsblog/ and are easy to edit to match your needs.

Customizing admin views

If you need to customize the admin view, just copy the files from vendor/binshopsblog/src/Views/binshopsblog_admin to resources/views/vendor/binshopsblog_admin Then you can modify them just like any other view file.

Routes

It will auto set all required routes (both public facing, and admin backend). There are some config options (such as changing the /blog/ url to something else), which can be done in the binshopsblog.php file.

Config options

All config options have comments which describe what they do. Please just refer to the binshopsblog.php file in your /config/ dir.

Custom User Model

You can change the default user model through the config file.

Events

You can find all the events that are fired by looking in the /src/Events directory.

Add these (and an Event Listener) to your EventServiceProvider.php file to make use of these events when they fire.

Built in CAPTCHA / anti spam

There is a built-in captcha (anti-spam comment) system built in, which will be easy for you to replace with your own implementation.

There is a basic anti-spam captcha function built-in.

See the config/binshops.php captcha section. There is a built in system (basic!) that will prevent most automated spam attempts. Writing your own captcha system:

I wrote the captcha system simple on purpose, so you can add your own captcha options. It should be easy to add any other captcha system to this.

If you want to write your own implementation then create your own class that implements \BinshopsBlog\Interfaces\CaptchaInterface, then update the config/binshopsblog.php file (change the captcha_type option).

There are three methods you need to implement: public function captcha_field_name() : string

Return a string such as "captcha". It is used for the form validation and . public function view() : string

What view file should the binshops::partials.add_comment_form view include? You can set this to whatever you need, and then create your own view file. The default included basic captcha class will return "binshops::captcha.basic". public function rules() : array

Return an array for the rules (which are just the standard Laravel validation rules. This is where you can check if the captcha was successful or not. Optional: public function runCaptchaBeforeShowingPosts() : null

This isn't part of the interface, it isn't required. By default it does nothing. But you can put some code in this method and it'll be run in the BinshopsReaderController::viewSinglePost method.

Image upload errors

Try adding this to config/app.php:

'Image' => Intervention\Image\Facades\Image::class
  • Also make sure that /tmp is writable. If you have open_basedir enabled, be sure to add :/tmp to its value.
  • Ensure that /public/blog_images (or whatever directory you set it to in the config) is writable by the server
  • You might need to set a higher memory limit, or upload smaller image files. This will depend on your server. I've used it to upload huge (10mb+) jpg images without problem, once the server was set up correctly to handle larger file uploads.

Version History

  • 9.2.x Stable version of package
  • 9.0.x Multi-language support beta release
  • 8.0.x Compatibility with Laravel 8
  • 7.3.0 New Admin UI
  • 3.0.1 - replaced all short tags (<?) with full opening ones (<?php)
  • 2.0 - added full text search (enable it via the config file - it is disabled by default).
  • 1.1.1 - added basic captcha
  • 1.0.5 - composer.json changes.
  • 1.0 - First release
  • 0.1 - Initial release

Contributors


Sam Berry


Alef Barbeli

Comments
  • Issue when listing all blogs

    Issue when listing all blogs

    i can add the posts successfully but now i am facing another issue when showing all the blog posts on homepage on this url en/blog. i can see the below error:

    Too few arguments to function HessamCMS\Models\HessamPostTranslation::url(), 0 passed in /var/www/html/ski_pro_web/vendor/hessam/laravel-blogger/src/Models/HessamPostTranslation.php on line 129 and exactly 1 expected (View: /var/www/html/ski_pro_web/resources/views/vendor/hessamcms/partials/index_loop.blade.php)

    opened by Naveedali1234 13
  • Issue during setup

    Issue during setup

    Hi :)

    thank you for the amazing package.

    i am trying to install it. After accessing the url /blog_admin/setup and making the English language as default language and clicking on setup package button, i am getting the following error:

    SQLSTATE[42703]: Undefined column: 7 ERROR: column "id" does not exist LINE 1: ...ed_at", "created_at") values ($1, $2, $3, $4) returning "id" ^ (SQL: insert into "hessam_configurations" ("key", "value", "updated_at", "created_at") values (INITIAL_SETUP, 1, 2021-01-21 08:17:56, 2021-01-21 08:17:56) returning "id")

    opened by Naveedali1234 9
  • installation failed

    installation failed

    Hello i'm facing this error while runing composer require hessam/laravel-blogger

     Error
    
      Class 'HessamCMS\Laravel\Fulltext\ModelObserver' not found
    
      at vendor/hessam/laravel-blogger/src/HessamCMSServiceProvider.php:33
         29▕     {
         30▕
         31▕         if (config("hessamcms.search.search_enabled") == false) {
         32▕             // if search is disabled, don't allow it to sync.
      ➜  33▕             ModelObserver::disableSyncingFor(HessamPostTranslation::class);
         34▕         }
         35▕
         36▕         if (config("hessamcms.include_default_routes", true)) {
         37▕             include(__DIR__ . "/routes.php");
    
          +7 vendor frames
      8   [internal]:0
          Illuminate\Foundation\Application::Illuminate\Foundation\{closure}(Object(HessamCMS\HessamCMSServiceProvider))
    
          +5 vendor frames
      14  artisan:37
          Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
    
    Installation failed, reverting ./composer.json and ./composer.lock to their original content.
    
    
    opened by mohamed-ea 9
  • Laravel 9 composer file issue

    Laravel 9 composer file issue

    Hello, thank you for this great package. I am having a problem with the installation. the command: composer require binshops/laravel-blog generates an error because I am using a later version of eloquent-sluggable. my composer file contains "cviebrock/eloquent-sluggable": "^9.0", Your composer file restricts the latest version to 8: "cviebrock/eloquent-sluggable": "~8.0|~7.0|~6.0|~4.8|~4.7|~4.6|~4.5", Please updade this so that I can automate the deployment

    Kind thanks Dale

    laravel9 
    opened by JustAnotherFalseProphet 5
  • Error in sluggable function

    Error in sluggable function

    I tried to add laravel-blog into my laravel project

    Laravel version 8.49.0 laravel-blog version: 8.1.2

    but I got this error Declaration of BinshopsBlog\Models\BinshopsBlogPost::sluggable() must be compatible with Cviebrock\EloquentSluggable\Sluggable::sluggable(): array

    I found solution here

    I think the solution is to change vendor/binshops/laravel-blog/src/Models/BinshopsBlogPost.php (line 61)

    public function sluggable(): array
    {
     ... ...
    }
    

    I used DO app for server

    unfortunately, DO app doesn't support editing package files

    opened by smart0120 5
  • post detail not show the style as created

    post detail not show the style as created

    Thanks much for package, I was create a post with different style like h1, h2, bold italic etc as ckeeditor provided but once published no style shown in output/front end and when go back to the backend editor the style change itself no style existing. Please find the image attached. will you please provide the code which will help to solve the problem blog

    opened by careerhub-source 5
  • Installation

    Installation

    I installed this with a basic Laravel 7 setup. Ran the ui and your composer and then migrate etc. I also amended the User.php as instructed and ran the migration.

    I amended your config file to set User to \App\User.

    Logged in on my local machine by registering and of course I got to the "your are logged in".

    However when I then tried to run http://localhost:8000/blog_admin/setup I received a 401 unauthorized message,

    opened by jim1506 4
  • How to implement InvisibleRecaptcha

    How to implement InvisibleRecaptcha

    Hi,

    Can you tell me how I can implement an Invisible reCaptcha. I'm using this package https://github.com/albertcht/invisible-recaptcha and It will be nice to have the same captcha mechanism on the whole website.

    Thank you.

    opened by dan-pascu 4
  • Url Length Exceeded

    Url Length Exceeded

    You guys are using patch method while editing post. When you change the language the whole content of the post is coming with the url which can be problematic for server because we can not specify the length of the url. If the content of the blog will increase it will cause Url too long, length exceeded error. I would recommend instead of get use post method. Because I'm facing this issue on our live server. Thanks

    opened by usman-xs4arabia-dev 3
  • Database seeder uses MySQL injection

    Database seeder uses MySQL injection

    CreateLaravelFulltextTable-class contains direct DB::Connection injection which creates columns for text search which uses however MySQL specific column type. Of course this works only when used DB engine is actually MySQL and perhaps MariaSQL.

    However, before knew of this, I l already selected Postgresql so did have to commented out two lines that specific class before it went trough.

    And you should suggest npm commands anyway since if took code via composer it does not contains predefined web files.

    opened by hozmaster 3
  • Category Not Displayed Properly

    Category Not Displayed Properly

    Trying to get the categories for a post to display is not currently possible.

    If I dump out the categories I get this data blob: [{"id":2,"created_by":null,"parent_id":null,"lft":1,"rgt":2,"depth":0,"created_at":"2021-12-23T17:32:11.000000Z","updated_at":"2021-12-23T17:32:11.000000Z","pivot":{"post_id":1,"category_id":2}}]

    but if I try to iterate over, there is no relationship available to get the category name.

    The provided code in categories.blade.php also does not work:

        @foreach($post->categories as $category)
            <a class='btn btn-outline-secondary btn-sm m-1' href='{{$category->url()}}'>
                {{$category->category_name}}
            </a>
        @endforeach```
    opened by scs-ben 3
  • Lazy Loading issues across the package

    Lazy Loading issues across the package

    There are a number of lazy loading issues across the package that start to arise once I have added more than one post, you are calling model relationships within views which is not ideal, it should be called with a YourModel::with('relation')->get() before passing into the view. I know I could turn off lazy loading but that is not ideal for performance.

    An example is line 58 of your NinshopsAdmin Controller. looks like this: $posts = BinshopsPostTranslation::orderBy("post_id", "desc")->where('lang_id', $language_id) ->paginate(10);

    should be this:

    $posts = BinshopsPostTranslation::with(['post'])->orderBy("post_id", "desc")->where('lang_id', $language_id) ->paginate(10);

    as you are calling $post->post->name in the view, there are a number of other instances as well.

    Screenshot 2022-07-15 at 15 07 17 enhancement 
    opened by Preshiousy1 2
  • How to show english posts for all language codes & link without language code?

    How to show english posts for all language codes & link without language code?

    My website uses 3 languages. Default: www.domainname (calls the english version) English: www.domainname/en German: www.domainname/de French: www.domainname/fr

    I want my blog to display only english posts, no matter what language the user uses.

    I created German and French languages in the blog admin panel. Default: www.domainname/blog (404 error) English: www.domainname/en/blog German: www.domainname/de/blog French: www.domainname/fr/blog

    How can I always show english posts for all language codes and also for the link without a language code (www.domainname/blog)?

    open for contribution v9.3.x 
    opened by dappstatus 7
  • Can not Edit or update the multi lingual category as you are doing for multi lingual post

    Can not Edit or update the multi lingual category as you are doing for multi lingual post

    I can see there is an option to add multi lingual categories but while editing I'm only getting the single language category. Is there any way which I'm not getting or you guys are still working on it?

    new feature 
    opened by usman-xs4arabia-dev 1
  • viewSinglePost fails when a post is unpublished

    viewSinglePost fails when a post is unpublished

    When I unpublish a post and try to access it via url, the code breaks on $categories = $blogPost->post->categories()->with([ 'categoryTranslations' => function ($query) use ($request) { $query->where("lang_id", '=', $request->get("lang_id")); } ])->get(); because $blogPost->post is null. Would be nice if this was handled and an exception was thrown or a 404 page was returned.

    waiting for review 
    opened by bagdaddy 0
  • A few mistakes

    A few mistakes

    Hi, Version 9.2.x Laravel v8.78.1 (PHP v8.0.10)

    1. Post publish to PL:

    ErrorException Attempt to read property "slug" on null (View: \www\blog\vendor\binshops\laravel-blog\src\Views\binshopsblog_admin\posts\edit_post.blade.php) http://blog.test/blog_admin/edit_post/1

    1. Does not display posts and categories in PL on the list of all entries. - DASHBOARD
    2. It does not convert Polish characters in URLs - (ą => a, ć => c, etc.)
    3. Why can't you only make a Polish version? How do I remove the prefix /pl/ or /en/ from a URL?
    4. How to set an entry as: domain.test/name-title-post ?? (At least for the site's default version.)
    5. /blog_admin/add_post_toggle - The categories to be displayed are not showing.

    Will the single language version be developed?

    waiting for review 
    opened by anielka41 0
Releases(v9.3.0)
Owner
Binshops
Best In Shops | E-Commerce Solutions
Binshops
The Easiest way to start using PHP CS Fixer and PHP_CodeSniffer with 0-knowledge

The Easiest Way to Use Any Coding Standard Features Blazing fast Parallel run Use PHP_CodeSniffer || PHP-CS-Fixer - anything you like 2nd run under fe

null 1.1k Jan 6, 2023
The easiest way to get started with event sourcing in Laravel

Event sourcing for Artisans ?? This package aims to be the entry point to get started with event sourcing in Laravel. It can help you with setting up

Spatie 591 Jan 4, 2023
The easiest way to match data structures like JSON/PlainText/XML against readable patterns. Sandbox:

PHP Matcher Library created for testing all kinds of JSON/XML/TXT/Scalar values against patterns. API: PHPMatcher::match($value = '{"foo": "bar"}', $p

Coduo 774 Dec 31, 2022
Parsica - PHP Parser Combinators - The easiest way to build robust parsers.

Parsica The easiest way to build robust parsers in PHP. composer require parsica-php/parsica Documentation & API: parsica-php.github.io <?php $parser

null 350 Dec 27, 2022
Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests

PHPUnit Polyfills Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests. Requirements Instal

Yoast 147 Dec 12, 2022
This plugin adds 95% of 1.16 blocks & items and their functionality

INether This plugin adds 95% of 1.16 blocks & items and their functionality Implemented blocks Ancient Debris All types of Basalt Crimson & Warped Fun

null 34 Dec 7, 2022
The fastest way to make a powerful JSON:API compatible Rest API with Laravel.

The first fully customizable Laravel JSON:API builder. "CRUD" and protect your resources with 0 (zero) extra line of code. Installation You can instal

BinarCode 394 Dec 23, 2022
The simplest way to create a dynamic sitemap for your self-coded website which you have made by using PHP/HTML/CSS/Js etc... Scripts.

Sitemap_index.xml The simplest way to create a dynamic sitemap for your self-coded website which you have made by using PHP/HTML/CSS/Js etc... Scripts

Tanish Raj 1 Oct 16, 2021
Task for GrumPHP that adds CSS linting support with stylelint. An easy way to enforce convention and avoid errors in your styles

grumphp-stylelint-task Installation Stylelint is a static analysis tool for styles. A mighty, modern linter that helps you avoid errors and enforce co

null 3 Apr 29, 2021
A project to add vanilla functionality into PocketMine-MP (4.0)

libVanilla A project to add vanilla functionality into PMMP. As this project was created specifically to support anvils/enchanting, those are the only

Valiant Network 10 Mar 31, 2022
Magento 2 Module that adds Donation Product Type. Enables the customer to add a donation (product) of a preferred amount to the cart.

Magento 2 Module Experius DonationProduct (RC1.0) Demo website: https://donationproduct.experius.nl Magento Marketplace: https://marketplace.magento.c

Experius 23 Apr 1, 2022
Adds my own text to WooCommerce add to cart button.

My Add to Cart Text Adds my own text to WooCommerce add to cart button. Installation Get the .zip package of this plugin. Install manually to your Wor

Kharis Sulistiyono 1 Jan 25, 2022
Magento 2 Blog Extension is a better blog extension for Magento 2 platform. These include all useful features of Wordpress CMS

Magento 2 Blog extension FREE Magento 2 Better Blog by Mageplaza is integrated right into the Magento backend so you can manage your blog and your e-c

Mageplaza 113 Dec 14, 2022
MOP is a php query handling and manipulation library providing easy and reliable way to manipulate query and get result in a fastest way

Mysql Optimizer mysql optimizer also known as MOP is a php query handling and manipulation library providing easy and reliable way to manipulate query

null 2 Nov 20, 2021
A robust and flexible way to add double-opt-in (DOI) to any form in Mautic

Mautic double-opt-in (DOI) plugin Adds a robust and flexible way to add a double-opt-in process (DOI) to any form in Mautic. What is the plugin for? I

Content Optimizer GmbH 11 Dec 29, 2022
Re-skinning BotCloaker enables you to add a SMART button at the end of all posts on your blog.

Re-skinning BotCloaker Wordpress Plugin Re-skinning BotCloaker enables you to add a SMART button at the end of all posts on your blog. Re-skinning Bot

Mohammed cha 120 Nov 11, 2022
Updates the disabled link manager functionality in WordPress, originally designed as a blogroll, to act as a bookmarking system.

=== Bookmark Links === Contributors: dshanske Tags: links, bookmarks, readlater Requires at least: 4.7 Tested up to: 5.4 Stable tag: trunk Requires PH

David Shanske 7 Nov 16, 2022
Magento 2 Blog is an extension that allows you to manage your store and blog

Magento 2 Blog Extension by Magefan Magento 2 Blog is an extension that allows you to manage your store and blog from one place without having to rely

Magefan 243 Dec 21, 2022