Download the PHP package bjuppa/laravel-blog without Composer

On this page you can find all versions of the php package bjuppa/laravel-blog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-blog

laravel-blog

Build Status

This package is a flexible blogging solution that you can add to your Laravel app.

Is takes blog entries from storage and publishes them to the Web in common formats for consumption by people and machines through URLs.

Each blog gets:

The default storage is Eloquent, but you can write your own BlogEntryProvider should you wish. Have a look at the files in src/Contracts for a quick overview of the entites this package handles.

Admin interface

This package does not provide any admin interface for editing blog entries. There's a separate package that can optionally be installed to provide admin routes for editing blog contents.

Another option is to create the mechanism to edit blog entries yourself, in your Laravel app. Entries are represented by Eloquent models by default, so shouldn't be too hard for Laravel developers.

Requirements

You need at least Laravel 5.6.8 to use this package. The included entry model and migration requires a database connection supporting json-type columns.

Usage

  1. Require the package:

    The package will automatically register itself.

  2. Publish the configuration file:

  3. Edit the published configuration file config/blog.php to setup your desired blogs and their options.

    Configurations may be changed later and more blogs can be added etc. Just remember that permalinks and generated entry IDs should ideally be kept constant after a blog has been published to avoid broken feeds and links for your audience.

    The service provider handles registration of routes to all configured blogs. You can check which routes and paths are generated using:

  4. Run migrations to automatically set up any tables needed to use the configured blog entry providers:

  5. (optional) If you want to create a default blog entry in the database you can run the seeder:

  6. (optional) If you want to use the included styling, first publish the CSS to your public directory:

    ...then edit config/blog.php and add 'css/blog.css' to the stylesheets config.

Now visit your fresh blog in a browser! The default url path is /blog unless you've changed the config.

Edit blog posts

Add and edit blog entries in the database any way you like. You can create your own admin interface, write straight to the database, or perhaps use php artisan tinker... 😉 The model used by default is Bjuppa\LaravelBlog\Eloquent\BlogEntry.

There is a separate package providing an admin interface.

User permissions

All published entries are public to view by anyone at their url.

To enable users to preview unpublished entries, first create a Laravel gate or policy (for your entry model) and then configure the preview_ability in your config/blog.php to match.

A gate defined in your App\Providers\AuthServiceProvider could look like this:

Styling the frontend

The included CSS file is built using Kingdom CSS, which is yet another CSS framework, created by... yours truly.

The default styling is meant to add some consistent styling to the standard HTML elements, so a blog using it will not look "designed", although it has some opinionated layout and spacing (especially on a larger screen). You could say it has a "brutalist" approach, it even uses browsers' default fonts.

Using the included utility classes

Blog authors may want to add some special styles to elements within their entries. Some classes are useful on elements that are on the first level within entry contents:

The included CSS contains many of Kingdom's utility classes, they're too many to document here, please refer to the original SASS files:

Creating your own styles

You probably want to create your own styles to apply your personal touch or branding. The stylesheets config in your config/blog.php is where you can include any CSS files you want into your blog.

You can add a list of files so you can combine this package's CSS file with an additional CSS file containing your own styles. Or you can use Laravel Mix to combine them into a single file.

If you're feeling adventurous, pull in the Kingdom npm package and use it in your build. You may draw inspiration from, or even include, the SASS files from this package.

Blade templates

The package keeps all its Blade views in resources/views and running this command will publish all of them into resources/views/vendor/blog of your app so you can edit them:

...however you probably only need to change a few bits in just some files. I'd recommend you to only commit the files you actually change to version control, and remove the rest of the published files that you have not changed from your app. Blade will fall back to using the package's views for any file not found in the vendor view directory.

Localization

This package contains English translation strings that can be published to your app using this command:

If you're not adding translations for a new language, you probably don't need all the files and not even all the strings within a file. Consider overriding just the ones you want, as explained in the Laravel documentation.

Custom entry providers and models

It is possible to pull out any configured Blog from the BlogRegistry within the boot() method of any Laravel service provider, and manipulate it beyond what is possible using the configuration files alone.

To use a custom BlogEntryProvider one can set it on an individual Blog using withEntryProvider().

To just use a custom entry model with a Blog one can use getEntryProvider()->withEntryModel(), as long as the entry provider is a Bjuppa\LaravelBlog\Eloquent\BlogEntryProvider.

Background

When looking for ways to add a simple blog to an existing Laravel app I found many packages and some complete Laravel apps, but none of them did what I expected:

Provide a highly configurable blog add-on that can be integrated into any Laravel app.

Povilas Korop had written a blog post about it some half a year before I ran into the same need. This package is my attempt at getting myself a couple of blogs without resorting to WordPress and hopefully provide something useful for other developers.

My needs were


All versions of laravel-blog with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3 || ^8.0
illuminate/view Version 5.6.* || 5.7.* || 5.8.* || ^6 || ^7 || ^8
illuminate/support Version ~5.6.8 || 5.7.* || 5.8.* || ^6 || ^7 || ^8
illuminate/database Version 5.6.*|| 5.7.* || 5.8.* || ^6 || ^7 || ^8
illuminate/routing Version 5.6.* || 5.7.* || 5.8.* || ^6 || ^7 || ^8
illuminate/http Version 5.6.* || 5.7.* || 5.8.* || ^6 || ^7 || ^8
spatie/laravel-sluggable Version ^2.1
bjuppa/metatagbag Version ^1.0
league/commonmark Version ^1.3 || ^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bjuppa/laravel-blog contains the following files

Loading the files please wait ....