Download the PHP package teksite/handler without Composer

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

Handler Package

About

A lightweight Laravel package designed to simplify common PHP and Laravel operations, including try-catch handling, database querying, and other utility functions.

Table of Contents

About

The Handler Package streamlines development by providing helper functions for managing try-catch blocks, fetching data from databases, and other common tasks in PHP and Laravel applications. It aims to reduce boilerplate code and improve code readability.

Author

Developed by Sina Zangiband.

Contact


Installation

Step 1: Install via Composer

Run the following command in your terminal:

bash composer require teksite/handler

Step 2: Register the Service Provider

For Laravel > 9

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

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

Features

Simplify exception handling with ServiceWrapper

Teksite\Handler\Actions\ServiceWrapper

Basic Usage

Advanced Configuration

Event Dispatching

The run() method accepts two optional parameters to dispatch custom events:

Example:

Event Classes Configuration:

Define your event classes in config/handler.php:

Note: Events are resolved using Laravel's service container, so dependency injection is fully supported in your event constructors.

ServiceResult Wrapper

By default, the output of both do() and ifFailed() is wrapped in a ServiceResult instance for consistent return values:

Disable wrapping:

Streamlined Database Query Methods

Teksite\Handler\Facade\FetchData (backed by Teksite\Handler\Services\FetchDataService)

FetchDataService is resolved from the container (it depends on the current Request), so use the FetchData facade or dependency injection - it is not a static class.

Example with ServiceWrapper

Standalone Usage

Fluent Usage

Every option can also be set fluently before calling get(), which is handy when the same query is built up conditionally:

Method Parameters

Search with Operators:

Once you're done with a shared/injected instance, resetOnly(), resetWith(), resetWithCount(), resetSearch(), resetOrdering(), resetPagination() and reset() clear the fluent state so it can be reused for a different query. forgetColumnsCache($model) and forgetAllColumnsCache() clear the cached column listing used to validate orderBy() input (this is also flushed automatically after migrations run).

HTTP Response Helper

Event System

How It Works

The ServiceWrapper automatically dispatches events when configured:

  1. Success Events - Triggered when the do() closure executes without errors
  2. Failure Events - Triggered when an exception is caught

Custom Event Example

Create your event class:

Configure in config/handler.php:

Use in your codes:

Advanced Event Dispatching

Control event dispatch per method call:

Configuration

Publish Configuration File

Support

For questions, issues, or feature requests, please reach out via:

Contributions are welcome! Feel free to submit a pull request or open an issue on GitHub.


All versions of handler with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version ^13
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/handler contains the following files

Loading the files please wait ...