Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,26 @@

## Unreleased

### Changed (breaking: renamed from Rehla to Stepwise)
The package is now **Stepwise** (`elbanbydev/stepwise`). Everything that carried the old name changed:

| Was (Rehla) | Now (Stepwise) |
| --- | --- |
| Composer `elbanbydev/rehla` | `elbanbydev/stepwise` |
| Namespace `Rehla\` and facade `Rehla` | `Stepwise\` and `Stepwise` |
| `config/rehla.php`, config key `rehla.*` | `config/stepwise.php`, `stepwise.*` |
| Env `REHLA_*` | `STEPWISE_*` |
| Tables `rehla_*` | `stepwise_*` (renamed for you by an upgrade migration, data kept) |
| Artisan `rehla:install`, `rehla:report`, `rehla:automate`, `rehla:prune` | `stepwise:install`, `stepwise:report`, `stepwise:automate`, `stepwise:prune` |
| Panel path `/rehla`, routes `rehla.*` | `/stepwise`, `stepwise.*` |
| Gate ability `viewRehla` | `viewStepwise` |
| Webhook path `rehla/webhooks/meta` | `stepwise/webhooks/meta` (update it in Meta's dashboard) |
| Views and translations `rehla::` | `stepwise::` |

To upgrade: `composer remove elbanbydev/rehla && composer require elbanbydev/stepwise`, rename `config/rehla.php` to `config/stepwise.php` (and its keys' env vars), replace `Rehla\` with `Stepwise\` in your code, update the Gate name and the Meta webhook URL, then run `php artisan migrate`. Your data is kept.

Fresh installs are not affected. The old `elbanbydev/rehla` package and its v0.5.0 tag are no longer maintained.

## v0.5.0 - 2026-12-03

First tagged release (earlier version headings below are development history and were never tagged). Highlights: automatic WhatsApp sending (rules, consent, webhook, panel tab, dry run, hardening), the "confirm sent" step, the rename to Rehla, and a refreshed package description and README.
Expand Down
112 changes: 58 additions & 54 deletions README.md

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "elbanbydev/rehla",
"description": "Rehla (رحلة) - track where every user is in your site's journey (finished, started, never started), re-engage them with a WhatsApp panel, and optionally send rule-based automatic WhatsApp nudges with consent, quiet hours and a dry run.",
"name": "elbanbydev/stepwise",
"description": "Stepwise - track where every user is in your site's journey (finished, started, never started), re-engage them with a WhatsApp panel, and optionally send rule-based automatic WhatsApp nudges with consent, quiet hours and a dry run.",
"keywords": [
"laravel",
"user-journey",
Expand All @@ -9,7 +9,7 @@
"user-progress",
"whatsapp",
"egypt",
"rehla",
"stepwise",
"whatsapp-automation",
"whatsapp-cloud-api",
"laravel-package"
Expand All @@ -33,21 +33,21 @@
},
"autoload": {
"psr-4": {
"Rehla\\": "src/"
"Stepwise\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Rehla\\Tests\\": "tests/"
"Stepwise\\Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"Rehla\\RehlaServiceProvider"
"Stepwise\\StepwiseServiceProvider"
],
"aliases": {
"Rehla": "Rehla\\Facades\\Rehla"
"Stepwise": "Stepwise\\Facades\\Stepwise"
}
}
},
Expand Down
40 changes: 20 additions & 20 deletions config/rehla.php → config/stepwise.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
return [

/*
| The Eloquent model that moves through the journey. Rehla never
| The Eloquent model that moves through the journey. Stepwise never
| migrates this model's table; it keeps its own tables instead.
*/
'user_model' => env('REHLA_USER_MODEL', 'App\\Models\\User'),
'user_model' => env('STEPWISE_USER_MODEL', 'App\\Models\\User'),

/*
| Attributes used in the panel: the display name and the WhatsApp
Expand Down Expand Up @@ -44,7 +44,7 @@
],

/*
| Last-visit tracking. Add the `rehla.activity` middleware alias to
| Last-visit tracking. Add the `stepwise.activity` middleware alias to
| your web (and/or api) middleware group. Writes are throttled so a
| busy user costs at most one write per throttle window.
*/
Expand All @@ -56,13 +56,13 @@
/*
| The admin panel. It stays closed (403) until you name a Gate
| ability in `panel.gate` and define it in your AuthServiceProvider:
| Gate::define('viewRehla', fn (User $user) => $user->isAdmin());
| Gate::define('viewStepwise', fn (User $user) => $user->isAdmin());
*/
'panel' => [
'enabled' => true,
'path' => 'rehla',
'path' => 'stepwise',
'middleware' => ['web'],
'gate' => 'viewRehla',
'gate' => 'viewStepwise',
// Show the Automation tab (rules, dry-run preview, history). false
// hides it and closes its routes; rules still work from config.
'automation_tab' => true,
Expand Down Expand Up @@ -93,31 +93,31 @@
| window, so automatic nudges need an approved template.
*/
'automation' => [
'enabled' => (bool) env('REHLA_AUTOMATION_ENABLED', false),
'provider' => env('REHLA_AUTOMATION_PROVIDER', 'log'),
'enabled' => (bool) env('STEPWISE_AUTOMATION_ENABLED', false),
'provider' => env('STEPWISE_AUTOMATION_PROVIDER', 'log'),

'providers' => [
'log' => ['driver' => 'log', 'channel' => null],

'meta' => [
'driver' => 'meta',
'phone_number_id' => env('REHLA_META_PHONE_NUMBER_ID'),
'access_token' => env('REHLA_META_ACCESS_TOKEN'),
'api_version' => env('REHLA_META_API_VERSION', 'v21.0'),
'language' => env('REHLA_META_TEMPLATE_LANGUAGE', 'ar'),
'phone_number_id' => env('STEPWISE_META_PHONE_NUMBER_ID'),
'access_token' => env('STEPWISE_META_ACCESS_TOKEN'),
'api_version' => env('STEPWISE_META_API_VERSION', 'v21.0'),
'language' => env('STEPWISE_META_TEMPLATE_LANGUAGE', 'ar'),
'timeout' => 15,
// For the webhook below: the token you type in Meta's webhook
// setup, and your Meta app secret (checks the signature).
'verify_token' => env('REHLA_META_VERIFY_TOKEN'),
'app_secret' => env('REHLA_META_APP_SECRET'),
'verify_token' => env('STEPWISE_META_VERIFY_TOKEN'),
'app_secret' => env('STEPWISE_META_APP_SECRET'),
],

// Any service that takes an HTTP request. Body values may use
// {phone} {message} {template} {language} {idempotency_key};
// a value of exactly {params} becomes the template parameter list.
'http' => [
'driver' => 'http',
'url' => env('REHLA_HTTP_URL'),
'url' => env('STEPWISE_HTTP_URL'),
'method' => 'POST',
'headers' => [],
'body' => ['to' => '{phone}', 'text' => '{message}'],
Expand All @@ -131,7 +131,7 @@
// A queued send whose job never ran (stopped worker, lost queue) is
// cancelled after this many hours so it cannot block the user. 0 = never.
'stale_queued_hours' => 24,
// `php artisan rehla:prune` deletes finished automatic sends older
// `php artisan stepwise:prune` deletes finished automatic sends older
// than this many days. null/0 = keep everything.
'retention_days' => null,

Expand Down Expand Up @@ -178,9 +178,9 @@
| Consent for automatic messages. Meta requires the user's opt-in.
| required: false lets automation message users without a record
| (an opt-out always blocks, whatever this says).
| source: "table" (Rehla::consent()->optIn($user)), "attribute" (a
| source: "table" (Stepwise::consent()->optIn($user)), "attribute" (a
| truthy column or accessor named in `attribute`), or "resolver"
| (an invokable class implementing Rehla\Contracts\ConsentResolver).
| (an invokable class implementing Stepwise\Contracts\ConsentResolver).
*/
'consent' => [
'required' => true,
Expand All @@ -199,7 +199,7 @@
| match (allowed because the user just wrote to you); null = silent.
*/
'webhooks' => [
'path' => 'rehla/webhooks/meta',
'path' => 'stepwise/webhooks/meta',
'middleware' => ['api'],
'stop_keywords' => ['stop', 'unsubscribe', 'إيقاف', 'توقف', 'إلغاء الاشتراك'],
'start_keywords' => [],
Expand All @@ -212,7 +212,7 @@
| without "+". Local numbers (leading 0) get the country code.
*/
'whatsapp' => [
'default_country_code' => env('REHLA_WHATSAPP_COUNTRY_CODE', '20'),
'default_country_code' => env('STEPWISE_WHATSAPP_COUNTRY_CODE', '20'),
],

];
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;

/**
* Stepwise was called Rehla before. An install upgraded from Rehla keeps its
* data: the old tables are renamed. Fresh installs skip this (nothing to rename).
*/
return new class extends Migration
{
private const TABLES = [
'rehla_step_progress' => 'stepwise_step_progress',
'rehla_activity' => 'stepwise_activity',
'rehla_templates' => 'stepwise_templates',
'rehla_follow_ups' => 'stepwise_follow_ups',
'rehla_consents' => 'stepwise_consents',
'rehla_automation_rules' => 'stepwise_automation_rules',
];

public function up(): void
{
foreach (self::TABLES as $old => $new) {
if (Schema::hasTable($old) && ! Schema::hasTable($new)) {
Schema::rename($old, $new);
}
}
}

public function down(): void
{
// Intentionally empty: renaming back would break the other migrations.
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
{
public function up(): void
{
Schema::create('rehla_step_progress', function (Blueprint $table): void {
// Already there: an install upgraded from the former Rehla package.
if (Schema::hasTable('stepwise_step_progress')) {
return;
}

Schema::create('stepwise_step_progress', function (Blueprint $table): void {
$table->id();
$table->string('trackable_type');
$table->unsignedBigInteger('trackable_id');
Expand All @@ -21,13 +26,13 @@ public function up(): void
$table->timestamp('completed_at')->nullable();
$table->timestamps();

$table->unique(['trackable_type', 'trackable_id', 'journey', 'step'], 'rehla_progress_unique');
$table->index(['journey', 'step'], 'rehla_progress_step_index');
$table->unique(['trackable_type', 'trackable_id', 'journey', 'step'], 'stepwise_progress_unique');
$table->index(['journey', 'step'], 'stepwise_progress_step_index');
});
}

public function down(): void
{
Schema::dropIfExists('rehla_step_progress');
Schema::dropIfExists('stepwise_step_progress');
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,25 @@
{
public function up(): void
{
Schema::create('rehla_activity', function (Blueprint $table): void {
// Already there: an install upgraded from the former Rehla package.
if (Schema::hasTable('stepwise_activity')) {
return;
}

Schema::create('stepwise_activity', function (Blueprint $table): void {
$table->id();
$table->string('trackable_type');
$table->unsignedBigInteger('trackable_id');
$table->timestamp('last_seen_at');
$table->timestamps();

$table->unique(['trackable_type', 'trackable_id'], 'rehla_activity_unique');
$table->index('last_seen_at', 'rehla_activity_last_seen_index');
$table->unique(['trackable_type', 'trackable_id'], 'stepwise_activity_unique');
$table->index('last_seen_at', 'stepwise_activity_last_seen_index');
});
}

public function down(): void
{
Schema::dropIfExists('rehla_activity');
Schema::dropIfExists('stepwise_activity');
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
{
public function up(): void
{
Schema::create('rehla_templates', function (Blueprint $table): void {
// Already there: an install upgraded from the former Rehla package.
if (Schema::hasTable('stepwise_templates')) {
return;
}

Schema::create('stepwise_templates', function (Blueprint $table): void {
$table->id();
$table->string('title');
$table->text('content');
Expand All @@ -19,12 +24,12 @@ public function up(): void
$table->string('type', 24);
$table->timestamps();

$table->index(['journey', 'step', 'type'], 'rehla_templates_lookup');
$table->index(['journey', 'step', 'type'], 'stepwise_templates_lookup');
});
}

public function down(): void
{
Schema::dropIfExists('rehla_templates');
Schema::dropIfExists('stepwise_templates');
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
{
public function up(): void
{
Schema::create('rehla_follow_ups', function (Blueprint $table): void {
// Already there: an install upgraded from the former Rehla package.
if (Schema::hasTable('stepwise_follow_ups')) {
return;
}

Schema::create('stepwise_follow_ups', function (Blueprint $table): void {
$table->id();
$table->string('trackable_type');
$table->unsignedBigInteger('trackable_id');
Expand All @@ -25,12 +30,12 @@ public function up(): void
$table->string('channel', 24)->default('whatsapp');
$table->timestamps();

$table->index(['trackable_type', 'trackable_id', 'created_at'], 'rehla_followups_user_index');
$table->index(['trackable_type', 'trackable_id', 'created_at'], 'stepwise_followups_user_index');
});
}

public function down(): void
{
Schema::dropIfExists('rehla_follow_ups');
Schema::dropIfExists('stepwise_follow_ups');
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@
*/
public function up(): void
{
Schema::table('rehla_follow_ups', function (Blueprint $table): void {
// Already there: an install upgraded from the former Rehla package.
if (Schema::hasColumn('stepwise_follow_ups', 'status')) {
return;
}

Schema::table('stepwise_follow_ups', function (Blueprint $table): void {
$table->string('status', 16)->default('opened')->after('channel');
$table->timestamp('sent_at')->nullable()->after('status');
});
}

public function down(): void
{
Schema::table('rehla_follow_ups', function (Blueprint $table): void {
Schema::table('stepwise_follow_ups', function (Blueprint $table): void {
$table->dropColumn(['status', 'sent_at']);
});
}
Expand Down
Loading
Loading