Download the PHP package botdigit/laravel-taxonomies without Composer

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

Laravel Taxonomies

Simple, nestable Terms & Taxonomies (similar to WordPress) for Laravel 7.

Important Notice

This package is a work in progress, please use with care and feel free to report any issues or ideas you may have!

We've transferred this package to a new owner and therefor updated the namespaces to Botdigit\Taxonomies. The config file is now config/lecturize.php.

Installation

composer require botdigit/laravel-taxonomies

Require the package from your composer.json file

and run $ composer update or both in one with $ composer require botdigit/laravel-taxonomies.

Next register the service provider and (optional) facade to your config/app.php file

Configuration & Migration

This will create a config/sluggable.php, a config/lecturize.php and a migration file, that you'll have to run like so:

Usage

First, add our HasTaxonomies trait to your model.

Add a Term
Add multiple Terms
Add a Term with optional parent (taxonomy) & order
Get all Terms for a model by taxonomy
Get a specific Term for a model by (optional) taxonomy
Convenience method for getTerm()
Remove a Term from model by (optional) taxonomy
Remove all Terms from model
Scope models with multiple Terms
Scope models with one Term

Example

Add categories to an Eloquent model

First fo all, this snippet will create three entries in your terms table, if they don't already exist:

Then it will create three entries in your taxonomies table, relating the terms with the given taxonomy "category".

And last it will relate the entries from your taxonomies table with your model (in this example a "Post" model) in your pivot table. use Botdigit\Taxonomies\Models\Taxable; use Botdigit\Taxonomies\Models\Taxonomy; use Botdigit\Taxonomies\Models\Term;

$terms = Taxonomy::where('taxonomy', 'tags')->with('term')->get();

Why three tables?

Imagine you have a Taxonomy called post_cat and another one product_cat, the first categorises your blog posts, the second the products in your online shop. Now you add a product to a category (a term) called Shoes using $product->addTerm('Sheos', 'product_cat');. Afterwards you want to blog about that product and add that post to a post_cat called Shoes as well, using $product->addTerm('Sheos', 'post_cat');.

Normally you would have two entries now in your database, one like ['Sheos','product_cat'] and another ['Sheos','post_at']. Oops, now you recognize you misspelled Shoes, now you would have to change it twice, for each Taxonomy.

So I wanted to keep my Terms unique throughout my app, which is why I separated them from the Taxonomies and simply related them.

License

Licensed under MIT license.

Author

Handcrafted by Tarun in India .


All versions of laravel-taxonomies with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0
illuminate/support Version ^7.0
illuminate/database Version ^7.0
cviebrock/eloquent-sluggable Version ^7.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 botdigit/laravel-taxonomies contains the following files

Loading the files please wait ....