PHPackages                             rmscms/helper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rmscms/helper

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rmscms/helper
=============

A helper package for Laravel applications

1.0(10mo ago)0381MITPHPPHP ^8.1

Since Jul 19Pushed 9mo agoCompare

[ Source](https://github.com/rmscms/helper)[ Packagist](https://packagist.org/packages/rmscms/helper)[ RSS](/packages/rmscms-helper/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (1)

RMS Helper Package for Laravel
==============================

[](#rms-helper-package-for-laravel)

A powerful utility package for Laravel applications, providing helper functions for Persian date handling, web services (REST and SOAP), Eloquent model scopes, and Excel import/export.

Installation
------------

[](#installation)

1. Install via Composer:

    ```
    composer require rmscms/helper
    ```
2. Add the service provider to `config/app.php` (optional, auto-discovered in Laravel):

    ```
    'providers' => [
        RMS\Helper\HelperServiceProvider::class,
    ],
    ```
3. Publish the configuration file:

    ```
    php artisan vendor:publish --provider="RMS\Helper\HelperServiceProvider" --tag="config"
    ```

Configuration
-------------

[](#configuration)

The package includes a configuration file at `config/helpers.php`:

```
return [
    'currency' => 'تومان',
];
```

Features
--------

[](#features)

### 1. Date Helper Functions

[](#1-date-helper-functions)

Handle Persian (Jalali) and Gregorian dates with ease.

- **`persian_date($date, $format = 'Y/m/d H:i:s')`**: Format a date as Persian.

    ```
    use Carbon\Carbon;
    echo \RMS\Helper\persian_date(Carbon::create(2025, 7, 20)); // 1404/04/29
    ```
- **`gregorian_date($date, $separator = '/')`**: Convert Persian date to Gregorian.

    ```
    echo \RMS\Helper\gregorian_date('1404/04/29'); // 2025/07/20
    ```
- **`persian_to_timestamp($date, $separator = '/')`**: Convert Persian date to Unix timestamp.

    ```
    echo \RMS\Helper\persian_to_timestamp('1404/04/29'); // 1752969600
    ```
- **`is_valid_persian_date($date, $separator = '/')`**: Validate Persian date.

    ```
    var_dump(\RMS\Helper\is_valid_persian_date('1404/04/29')); // true
    ```
- **`persian_date_diff($startDate, $endDate, $separator = '/')`**: Calculate days between two Persian dates.

    ```
    echo \RMS\Helper\persian_date_diff('1404/04/29', '1404/04/30'); // 1
    ```
- **`persian_now($format = 'Y/m/d H:i:s')`**: Get current Persian date.

    ```
    echo \RMS\Helper\persian_now(); // e.g., 1404/04/29 14:00:00
    ```

### 2. Number and Currency Helpers

[](#2-number-and-currency-helpers)

Format numbers and convert Persian/Arabic digits.

- **`displayAmount($amount, $sign = null)`**: Format amount with currency.

    ```
    echo \RMS\Helper\displayAmount(1000); // 1,000 تومان
    echo \RMS\Helper\displayAmount(1000, 'ریال'); // 1,000 ریال
    ```
- **`changeNumberToEn($string)`**: Convert Persian/Arabic numbers to English.

    ```
    echo \RMS\Helper\changeNumberToEn('۱۲۳۴۵۶'); // 123456
    ```

### 3. Eloquent Model Scopes

[](#3-eloquent-model-scopes)

Enhance Eloquent models with useful scopes via `ModelTrait`.

```
use Illuminate\Database\Eloquent\Model;
use RMS\Helper\Eloquent\ModelTrait;

class TestModel extends Model
{
    use ModelTrait;
    protected $table = 'test_table';
}
```

- **`active()`**: Filter active records.

    ```
    TestModel::active()->get();
    ```
- **`countAndSum($column = 'amount')`**: Get count and sum of a column.

    ```
    TestModel::countAndSum()->first(); // ['total_count' => X, 'total_sum' => Y]
    ```
- **`today()`**: Filter records created today.

    ```
    TestModel::today()->get();
    ```
- **`yesterday()`**: Filter records created yesterday.

    ```
    TestModel::yesterday()->get();
    ```
- **`whereLike($column, $value)`**: Search column with LIKE.

    ```
    TestModel::whereLike('name', 'test')->get();
    ```
- **`orderByLatest()`**: Order by latest `created_at`.

    ```
    TestModel::orderByLatest()->get();
    ```
- **`whereInDateRange($start, $end, $column = 'created_at')`**: Filter records in date range.

    ```
    TestModel::whereInDateRange('2025-07-01', '2025-07-20')->get();
    ```
- **`withTrashed()`**: Include soft-deleted records.

    ```
    TestModel::withTrashed()->get();
    ```
- **`whereStatus($status, $column = 'status')`**: Filter by status.

    ```
    TestModel::whereStatus('pending')->get();
    ```

### 4. Web Services

[](#4-web-services)

Handle REST and SOAP web services.

#### REST Web Service

[](#rest-web-service)

```
use RMS\Helper\WebServices\Rest;

class SampleRestService extends Rest
{
    protected function url(string $uri = ''): string { return 'https://api.example.com/' . $uri; }
    protected function requestMethod(): string { return 'GET'; }
}

$service = new SampleRestService();
$result = $service->withParameters(['key' => 'value'])->send();
```

#### SOAP Web Service

[](#soap-web-service)

```
use RMS\Helper\WebServices\Soap;

class SampleSoapService extends Soap
{
    protected function url(): string { return 'https://www.w3schools.com/xml/tempconvert.asmx?WSDL'; }
}

$service = new SampleSoapService();
$result = $service->call('CelsiusToFahrenheit', ['Celsius' => '25']);
```

### 5. Excel Import/Export

[](#5-excel-importexport)

Simplify Excel operations with `ExcelHelper`.

```
use RMS\Helper\Excel\ExcelHelper;
use App\Models\TestModel;

// Export
ExcelHelper::export(TestModel::query(), 'test_export', ['id', 'name']);

// Import
ExcelHelper::import(request()->file('file'), TestModel::class, ['name', 'value']);
```

Testing
-------

[](#testing)

Run tests to ensure functionality:

```
cd packages/rms/helper
php vendor/bin/phpunit
```

Requirements
------------

[](#requirements)

- PHP ^8.1
- Laravel ^12.0
- `guzzlehttp/guzzle` ^7.0
- `morilog/jalali` ^3.0
- `maatwebsite/excel` ^3.1

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance56

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

303d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2f66ffa1fad090692a590599112faa3451ceaac3a99e46de5a3f4a7a1f1872b?d=identicon)[spyp](/maintainers/spyp)

---

Top Contributors

[![spyp](https://avatars.githubusercontent.com/u/15471788?v=4)](https://github.com/spyp "spyp (13 commits)")

### Embed Badge

![Health badge](/badges/rmscms-helper/health.svg)

```
[![Health](https://phpackages.com/badges/rmscms-helper/health.svg)](https://phpackages.com/packages/rmscms-helper)
```

###  Alternatives

[nativephp/mobile

NativePHP for Mobile

82724.0k43](/packages/nativephp-mobile)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)[glhd/conveyor-belt

14797.0k](/packages/glhd-conveyor-belt)[pulkitjalan/ip-geolocation

IP Geolocation Wrapper with Laravel Support

89164.9k1](/packages/pulkitjalan-ip-geolocation)[bakame/laravel-domain-parser

Laravel package to integrate PHP Domain parser.

26534.8k4](/packages/bakame-laravel-domain-parser)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
