Download the PHP package achyutn/laravel-helpers without Composer

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

Laravel Helpers

Lint PR Bump version Latest Stable Version Total Downloads Dependents

Installation

You can install the package via composer:

Usage

Traits

You can use following traits for your models:

HasTheSlug

This trait is used to generate slug for your model. It uses cviebrock/eloquent-sluggable package.

Note: You must have slug column in your table. And the source is by default title column but can be changed by setting the $sluggableColumn property in your model.


HasTheMedia

This trait is used to add media conversions over the HasMedia trait from spatie/laravel-medialibrary package.

or alternatively, you can extend your model using the MediaModel class provided by the package:

You can use:

Multiple Collections

You can also define multiple collections in your model. For example, if you want to have a gallery and a profile collection along with the default cover collection, you can do it like this:

You can then access these collections using the same methods as above:


HasTheDashboardTraits

This trait is used to add HasTheSlug and HasTheMedia traits to your model.


CanBeApproved

This trait adds approval logic to your Eloquent models using timestamp-based flags (approved_at, rejected_at). By default, only approved records are returned in queries due to a global scope.

Make sure your model's table includes approved_at and rejected_at columns:

Then, use the trait in your model:

Methods
Method Description
setApproved() Marks the model as approved (sets approved_at, clears rejected_at)
setRejected() Marks the model as rejected (sets rejected_at, clears approved_at)
setPending() Resets approval state (clears both approved_at and rejected_at)
Scope

The trait adds a global scope to only include approved records. You can override it using the following query macros:

Macro Description
withPending() Includes approved and pending records
onlyPending() Only records where both approved_at and rejected_at are null
withoutApproved() Records that are not approved (includes pending & rejected)
withRejected() Rejected records (rejected_at not null, approved_at null)
onlyRejected() Strictly rejected records (regardless of previous approval)
withAll() Removes global scope and returns all records
Custom Column Names

You can override the default column names by defining constants in your model:


CanBeInactive

This trait allows Eloquent models to be marked as inactive or active, using a nullable inactive_at timestamp column. By default, only active models are returned from queries due to a global scope.

Setup

Ensure your model's table includes an inactive_at column:

Then, use the trait in your model:

Methods
Method Description
setInactive() Marks the model as inactive (sets inactive_at to current time)
setActive() Marks the model as active (clears the inactive_at column)
Scopes

This trait applies a global scope to include only active models by default. Use the following macros to override:

Macro Description
withInactive() Includes both active and inactive models
withoutInactive() Excludes inactive models (same as default scope)
onlyInactive() Returns only inactive models
Custom Column Name

You can override the column name by defining a constant in your model:


Nepali Helpers

You can simply use following helper functions:

english_nepali_number

Converts english number to nepali number.

english_nepali

To select value based on the locale.


Validations

LatitudeRule

This rule ensures that the given value is a numeric latitude within the valid range -90 to 90.


LongitudeRule

This rule ensures that the given value is a numeric longitude within the valid range -180 to 180.


All versions of laravel-helpers with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
spatie/laravel-medialibrary Version >=8.0
cviebrock/eloquent-sluggable Version >=11.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 achyutn/laravel-helpers contains the following files

Loading the files please wait ....