Download the PHP package digikraaft/laravel-posts without Composer

On this page you can find all versions of the php package digikraaft/laravel-posts. 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-posts

Add basic Blog/Post functionality to your Laravel app.

GitHub Tests Action Status GitHub Check and fix styling

Why this package?

This package provides a simple blog functionality for use in a Laravel app. This is an opinionated package. We have had to implement blog functionalities in different Laravel projects and decided to abstract this into a package which can be easily used across our projects. If you find it useful and meets your needs, by all means please use it. Suggested improvements are welcome.

Notes on dependencies

This package uses the following dependencies. Please ensure to follow the installation and usage instructions from their respective repositories:

Usage

Please note that the author $author must be an eloquent model otherwise an exception Digikraaft\LaravelPosts\Exceptions\InvalidArgumentException will be thrown.

Installation

You can install the package via composer:

You must publish the migration with:

Run the migration to publish the posts table with:

You can optionally publish the config-file with:

The content of the file that will be published to config/laravel-posts.php:

Usage

Create a post

Create post with attributes

Please note that the author $author must be an eloquent model otherwise an exception Digikraaft\LaravelPosts\Exceptions\InvalidArgumentException will be thrown.

All attributes are optional. If you need to add additional information about a post, you can use the meta attribute this way:

Create post with custom attributes

If you need to save specific information on a post, you can do it by using custom attributes.

Please ensure you have added the attributes as columns to the posts migration otherwise, Laravel will throw an exception.

Retrieving Posts

The Post model is a normal eloquent model so all eloquent methods and query builders can be used in retrieving posts.

For more ways to retrieve posts and use the dependencies, check usage instructions of the following packages:

Retrieving basic Post Stats

You can get the reading time of a post:

Using Slug

This package uses Laravel Sluggable by Spatie to handle categories. Please check their usage and installation instructions.

Using Categories

This package uses Laravel Categories by Rinvex to handle categories. Please check the usage and installation instructions. This package however has helper classes to use categories:

Using Tags

This package uses Laravel Tags by Spatie to handle tags. Please check the usage and installation instructions. Here are a few ways to use:

For more tag usage, checkout the documentation

Events

The Digikraaft\LaravelPosts\Events\PostCreatedEvent event will be dispatched when a post has been created. You can listen to this event and take necessary actions. An instance of the post will be passed to the event class and can be accessed for use:

Custom model and migration

You can change the model used by extending the Digikraaft\LaravelPosts\Models\Post class.

You can also change the column name used in the dk_posts table (default is model_id) when using a custom migration. If this is the case, also change the model_primary_key_attribute key of the laravel-posts config file.

Testing

Use the command below to run your tests:

More Good Stuff

Check here for more awesome free stuff!

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-posts with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/contracts Version ^10.0
rinvex/laravel-categories Version ^7.1
spatie/laravel-activitylog Version ^4.7
spatie/laravel-model-status Version ^1.14
spatie/laravel-sluggable Version ^3.5
spatie/laravel-tags Version ^4.4
spatie/laravel-translatable Version ^6.5
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 digikraaft/laravel-posts contains the following files

Loading the files please wait ....