Download the PHP package teksite/extralaravel without Composer

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

ExtraLaravel

A collection of reusable utilities, helpers, casts, validation rules, traits, Artisan commands, route macros and Laravel developer tools.

ExtraLaravel is designed to provide commonly needed functionality for Laravel applications without introducing unnecessary dependencies or forcing a specific architecture.


Features


Requirements

The package is designed to work with modern Laravel applications.

Installation

Step 1: Install via Composer

Install the package through Composer:

Step 2: Register the Service Provider

For Laravel > 9

Add the service provider to the bootstrap/providers.php file:

For Laravel 5.x and Earlier

Add the service provider to the config/app.php file under the providers array:

Note: Laravel 5.5 and above supports auto-discovery, so this step is not required for newer versions.


Configuration

Publish the package configuration:

Or publish a specific configuration group if you expose individual publish tags.

The package configuration can contain:


Eloquent Casts

IP Cast

The IpCast automatically uses the request IP address when no value is explicitly provided.

When creating a model:

The current request IP will be stored automatically.

You can also explicitly provide an IP:


Jalali Date Cast

JalaliDateCast provides automatic Jalali/Gregorian conversion based on the current application locale.

When the application locale is:

the date is converted to Jalali when reading the model.

When saving a Jalali date, it can be converted back to Gregorian automatically.

The cast expects the following helper functions to be available:

If these functions are unavailable, the original value is returned.


Slug Cast

The SlugCast automatically converts a value into a URL-friendly slug.

Example:

The stored value becomes:


Enum Files

The package provides Enum files for various purposes, such as:

Validation Rules

Iranian National Code

Validate an Iranian National Code using:

The rule validates the 10-digit Iranian national identification code and its check digit.


Mobile Number Rule

The MobileRule supports country-specific mobile number validation through the package's MobilePatterns enum.

Example:

By default, Iran is used:

You can also specify a country:

Or multiple countries:

The exact supported countries depend on the available MobilePatterns enum values.


Password Rule

Validate password strength:

The rule checks for:


No HTML Rule

Prevent HTML tags from being submitted:

For example:

is accepted, while:

is rejected.

This rule is intended for validation. It should not be considered a replacement for output escaping or XSS protection.


Never Pass Rule

NeverPassRule is a rule that always fails validation.

This can be useful for temporarily disabling fields or testing validation flows.


API Form Request

The package provides:

Instead of Laravel's default validation response, validation errors are returned as JSON.

Example:

A validation failure returns a response similar to:

Authorization failures return:


Phone Verification

The MustVerifyPhone trait provides phone verification functionality similar to Laravel's email verification system.

Add the trait to your User model:

Your model must have:

columns.


Check Phone Verification

Returns:

or:


Mark Phone as Verified


Mark Phone as Unverified


Get Phone for Verification

By default, the value of:

is returned.


Send Verification Notification

The model using this trait must implement:

This allows the package to remain independent of a specific SMS provider.


Trash / Soft Delete Management

The TrashMethods trait provides a reusable API for managing soft-deleted models.

Your model must use Laravel's:

trait.

Example manager:


Count Trashed Records


Get Trashed Records

Custom pagination:


Restore Records

Restore one record:

Restore multiple records:


Restore All


Permanently Delete Records

Permanently delete one:

Multiple records:


Permanently Delete Everything in Trash

wipe() and wipeAll() use Laravel's forceDelete() and permanently remove records.


Trash Resource Routes

ExtraLaravel provides a trashResource() route macro for creating standardized soft-delete routes.

Example:

This can generate routes for:

Action Method URI
Index GET /users/trash
Reinstate PATCH /users/trash/{id}
Prune DELETE /users/trash/{id}
Restore PATCH /users/trash
Flush DELETE /users/trash

The controller should provide the corresponding methods:


Route Middleware

Middleware can be supplied through the options array:


Custom Prefix


Custom Route Name Prefix


Only Specific Actions


Exclude Actions


Artisan Commands

ExtraLaravel provides several custom Artisan commands.


API Request Generator

Create an API Form Request:

Example nested request:

The generated class extends:


Logic Generator

Create a Logic class:

Nested class:

Logic classes can be used for database queries and application-specific business/query logic.


Trash Controller Generator

Create a soft-delete controller:

For an API controller:


Cache Purge Command

ExtraLaravel provides:

The command can clean:


Dry Run

To inspect what would be deleted without deleting anything:


Force Production Execution

By default, destructive execution in production asks for confirmation.

To force execution:


Batch Size

Default batch size:

Custom:


Skip Database Cache


Skip File Cache


Skip Sanctum Tokens


Custom Database Connection


Honeypot Middleware

ExtraLaravel provides a simple honeypot middleware to detect automated form submissions.

Configuration:

Register the middleware in your application according to your Laravel version and apply it to the routes/forms you want to protect.

Example form field:

The field should normally remain empty.

If a request submits a non-empty honeypot field, the middleware rejects the request.


Blade Recursive Directive

ExtraLaravel provides a recursive Blade directive.

Example:

It can be used for recursively rendering nested arrays or traversable data.

For arrays stored in variables that may need casting:


Helper Functions

ExtraLaravel provides several global helper functions.


changeToSlug

Convert text to a slug:

Result:

Custom separator:


toEnglishNumber

Convert Persian and Arabic digits to English digits:

Result:

Arabic digits are also supported:


normalizePersianText

Normalize common Arabic characters to their Persian equivalents:

The helper also removes Arabic diacritics.


convertSeconds

Convert seconds to:

Example:

Result:

You can request an array:

Result:


currentUrlWithoutQueries

Get the current URL without query parameters:


exploding

Split a string using both English and Persian commas:

Returns a Laravel Collection.


var_export_short

A shorter array representation of var_export():

To return the generated string:


arrayToDot

Convert Laravel-style array notation to dot notation:

Result:


dotToArray

Convert dot notation to array-style notation:

Result:


normalizePath

Normalize filesystem paths:


is_rtl

Determine whether a language is RTL:

Result:

If no language is provided, the current application locale is used:


get_error

Retrieve validation errors using array-style field names:


getStaticData

Read static data from PHP files using dot notation.

Example directory:

If tehran.php contains:

You can retrieve it using:

Result:

A default value can be provided:


Suggested Project Structure

A typical application using ExtraLaravel can organize its code as:

Generated classes can then follow a predictable structure:


Design Philosophy

ExtraLaravel intentionally focuses on small, reusable Laravel components rather than providing a large framework on top of Laravel.

The package follows several principles:


Security Notes

ExtraLaravel does not replace Laravel's built-in security mechanisms.

In particular:


Contributing

Contributions are welcome.

Before submitting a pull request:

  1. Write or update tests.
  2. Follow Laravel coding conventions.
  3. Run the test suite.
  4. Run static analysis if configured.
  5. Run the code formatter.
  6. Keep changes focused and backwards compatible where possible.

License

This package is open-sourced software licensed under the MIT license.

See the LICENSE file for more information.


Roadmap

Possible future additions:

Author

Developed by Sina Zangiband.

Contact


All versions of extralaravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version ^13.0
morilog/jalali Version ^3.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 teksite/extralaravel contains the following files

Loading the files please wait ...