Download the PHP package nzesalem/lastus without Composer

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

Lastus

Easy status addition and management for your Eloquent models in Laravel.

Build Status Latest Stable Version License

What is lastus/status?

Consider you are building a forum app, you would typically have a User model/class. A User can be in different states or have different statuses at different points in time. For example when a user first registers for the forum you may want his/her status to be unverified indicating that the user have not verified his/her email. When the user verifies his/her email, he/she may become active. If the user violates one or more of the forum rules, he/she may become suspended, and so on.

Lastus package for Laravel 5 aims to handle all of this for you automatically, with minimal configuration.

Database migrations

Your database tables should have a status column defined as the tinyInteger type. Lastus automatically adds this column to your users table (if it doesn't already exist) when you run the php artisan migrate command after adding Lastus to your project.

You should manually generate migrations for other of your tables as needed. Below is an example of how you would add the status column to a posts table.

First run:

Then edit the generated migration file like so (usually located at database/migrations):

And finally run:

Updating your Eloquent Models

Your models should use the LastusTrait and define a STATUSES array constant.

The keys of the STATUSES array should be in all caps and multiple words should be separated with underscore. Ideally it should follow the same naming rules and convention as PHP constants.

The values of the STATUSES array can be any number within the TINYINT range.

And that's it ...

Usage

When saving models, just set its status property to one of the keys you have defined above, but in all lower case, multiple words should be separated by a hyphen. E.g PENDING_APPROVAL becomes pending-approval. This is the format you will use most of the time when working with statuses.

Retrieving a model status:

You can get the status code whenever you need it. For example, status key strings will not work if you try to perform raw queries with them. So, in those cases you need the status codes instead:

Getting all the defined statuses for a given model is also easy as the snippet below. We get all the defined statuses for the User model and display them in a select element:

Or you can use the Lastus facade:

Blade templates

You can use the @status() blade directive to control the visibility of elements based on the status of the currently logged in user:

Middleware

You can use a middleware to filter routes and route groups by status:

License

Lastus is released under the MIT License.


All versions of lastus with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1.0
illuminate/support Version ^10.7
doctrine/dbal Version ^3.6
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 nzesalem/lastus contains the following files

Loading the files please wait ....