Download the PHP package imanghafoori/laravel-temp-tag without Composer

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

Eloquent Temporary Tags

Auto-expiring tags with additional payload data on any eloquent model.





image


Built with :heart: for every smart Laravel developer

Scrutinizer Code Quality StyleCI Check Imports



Installation:

Then you can publish and migrate to create the needed tags table

Sample Application in laravel 8:

https://github.com/imanghafoori1/laravel-tasks

In this Daily Task app, you can mark your tasks as complete,failed,ignored and etc but they rollback back to the default state at the end of the day, so you can re-mark them for tomorrow.

Use cases:

Then you put a temporary tag on them and check to see if the model has the tag.

Tag Payload:

You can also store some additional json data, for example why the user got banned, or who banned the user, or a slug or a translation of the title.

This is done by passing the third argument as an array to the method

Keynotes:


Example:

1- Tag a user until tomorrow

2- After an hour the tag is still active, so:

3- After a week, the tag gets expired so:


Getting payload data:

There are 2 ways to get payload data :

You can use getPayload method

or You can act like eloquent attributes :


Deleting tags:

Note: You can also use * wildcard which matcher 0 or more characters (just like % in sql)

Note: These fire "deleting" and "deleted" eloquent events for each one of them.

Expire the tag with title of "banned" right now:


These methods just do what they say:


Fetch only tagged models:

Let's say you have a slider for your Product model and you want to show only those records which are tagged with 'slider'.

First you have to put Imanghafoori\Tags\Traits\hasTempTags trait on the Product model.

Now you can perform these queries:

Note: If you pass an array of tags it acts like a whereIn(), so if the row has one of tags if will be selected.

If you want to find products which will be active until tomorrow, you can use hasActiveTagsAt, or hasNotActiveTagsAt as illustrated below:

Example:

When you want to send a notification to users, just 24 hours before their VIP account gets finished, so that they can charge.


Absence of tags:

Example:

When you want your article to be published in the future, go can tag your articles with a custom tag title like: "hidden" And fetch them like this:

So, as long as the 'hidden' tag is active the article does not show on the list and when the tag gets expired the article goes live.


Filtering based on payload:

The above example gives you the products with active status tag which have also payload data with the specified key and value.

Note: You can also use * wildcard which matcher 0 or more characters (just like % in sql):


Advanced Usage:

Each and every has...Tag method also has a twin orHas...Tag so you can put multiple conditions in the query.

Remember that they both should reside in a ->where(function ($q) { beside one another.


Auto-delete Expired tags:

In order to save disk space and have faster db queries you may want to delete the expired tags.

After you have performed the basic installation you can start using the tag:delete-expired command. In most cases you'll want to schedule this command so you don't have to manually run it everytime you need to delete expired tags.


:raising_hand: Contributing:

If you find an issue or have a better way to do something, feel free to open an issue, or a pull request.

:star: Your Stars Make Us Do More :star:

As always if you found this package useful, and you want to encourage us to maintain and work on it, just press the star button to declare your willingness.


More from the author:

Laravel Microscope

:gem: It automatically find bugs in your laravel app

Laravel HeyMan

:gem: It allows you to write expressive code to authorize, validate, and authenticate.


This package is originally inspired by the cybercog/laravel-ban package.



It's not that I'm so smart, it's just that I stay with problems longer. "Albert Einstein"


All versions of laravel-temp-tag with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3|8.*
illuminate/database Version ^5.5|^6.0|^7.0|^8.0|^9.0|10.*
illuminate/events Version ^5.5|^6.0|^7.0|^8.0|^9.0|10.*
illuminate/support Version ^5.5|^6.0|^7.0|^8.0|^9.0|10.*
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 imanghafoori/laravel-temp-tag contains the following files

Loading the files please wait ....