PHP code example of atannex / nweh-mundani-core

1. Go to this page and download the library: Download atannex/nweh-mundani-core library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

atannex / nweh-mundani-core example snippets


use Atannex\NwehMundani\Core\Facades\NwehMundani;

use Atannex\NwehMundani\Core\Facades\NwehMundani;

$calendar = NwehMundani::calendar('nweh');

$day = $calendar
    ->fromCivil('2026-10-28')
    ->cycle('traditional-days');

$day->label();     // Amina
$day->ordinal();   // 4
$day->certainty;   // Certainty::Assumed

$result = NwehMundani::compare('2026-10-28');

$labels = $result->labels();

[
    'mmock' => 'Ngong',
    'mmouck' => 'Njϐngong',
    'mundani-wabane' => 'Kèlu̧',
    'nweh' => 'Amina',
]

$next = $calendar->nextOccurrence(
    'amina',
    '2026-10-29'
);

$occurrences = $calendar->occurrencesBetween(
    'amina',
    '2026-10-01',
    '2026-12-31'
);

$period = $calendar->periodContaining('2026-10-28');

$month = NwehMundani::calendar('nweh')
    ->month(2026, 10);

$month->firstIsoWeekday;
$month->day(28)->label();
$month->day(28)->occurrences;
$month->next;

public function calendar()
{
    $month = NwehMundani::calendar('nweh')
        ->month(2026, 10);

    return response()->json($month);
}

$calendar->year(2026);

$calendar->day('2026-10-28');

$calendar->days('2026-10-01', '2026-10-31');

use Atannex\NwehMundani\Core\Facades\NwehMundani;

NwehMundani::register([
    'id' => 'market-week',
    'version' => '1.0.0',

    'name' => [
        'original' => 'Market week',
        'language' => 'en',
    ],

    'driver' => 'cyclic',

    'cycles' => [
        [
            'id' => 'days',

            'positions' => [
                ['id' => 'first', 'label' => 'First'],
                ['id' => 'second', 'label' => 'Second'],
                ['id' => 'third', 'label' => 'Third'],
                ['id' => 'fourth', 'label' => 'Fourth'],
                ['id' => 'fifth', 'label' => 'Fifth'],
            ],

            'anchors' => [
                [
                    'id' => 'ref',
                    'date' => '2026-01-01',
                    'position' => 'first',
                ],
            ],
        ],
    ],
]);

use Atannex\NwehMundani\Core\Application\CalendarWorkflowService;

$workflow = app(CalendarWorkflowService::class);

// Create or save a draft.
$workflow->saveDraft($definition, $editor);

// Submit the definition for review.
$workflow->submitForReview(
    'market-week',
    '1.0.0',
    $editor
);

// Approve the definition.
$workflow->approve(
    'market-week',
    '1.0.0',
    $reviewer
);

// Publish the approved definition.
$workflow->publish(
    'market-week',
    '1.0.0',
    $reviewer
);

use Illuminate\Support\Facades\Gate;
use Atannex\NwehMundani\Core\Governance\CalendarAuthorizer;

Gate::define(
    CalendarAuthorizer::MANAGE_CALENDARS,
    fn ($user, $tenant, $calendar) => $user->isEditor()
);

Gate::define(
    CalendarAuthorizer::REVIEW_CALENDARS,
    fn ($user, $tenant, $calendar) => $user->isReviewer()
);

Gate::define(
    CalendarAuthorizer::PUBLISH_CALENDARS,
    fn ($user, $tenant, $calendar) => $user->isReviewer()
);

use Atannex\NwehMundani\Core\Governance\SystemActor;

$actor = new SystemActor('import');

use Atannex\NwehMundani\Core\Application\ObservanceManagementService;

$observances = app(ObservanceManagementService::class);

$observances->create([
    'id' => 'market',

    'calendar' => 'nweh',

    'name' => 'Market day',

    'category' => 'market',

    'rules' => [
        [
            'type' => 'cycle-position',

            'parameters' => [
                'cycle' => 'traditional-days',
                'positions' => ['amina'],
            ],
        ],
    ],
], $editor, publish: true);

$events = NwehMundani::calendar('nweh')
    ->observancesOn('2026-10-28');

$observances->cancelOccurrence(
    'nweh',
    'market',
    '2026-11-05',
    $editor,
    'Funeral in the village'
);

$observances->rescheduleOccurrence(
    'nweh',
    'market',
    '2026-11-13',
    '2026-11-14',
    $editor
);

$calendar = NwehMundani::forTenant($team->id)
    ->calendar('nweh');

Atannex\NwehMundani\Core\Tenancy\TenantResolver

'continuity' => 'verified',
bash
php artisan nweh-mundani:install
bash
php artisan nweh-mundani:diagnose
bash
php artisan vendor:publish --tag=nweh-mundani-migrations
bash
php artisan migrate
bash
php artisan vendor:publish --tag=nweh-mundani-landlord-migrations
bash
php artisan migrate \
    --path=database/migrations/landlord \
    --database=landlord
bash
php artisan nweh-mundani:diagnose
bash
php artisan nweh-mundani:list
bash
php artisan nweh-mundani:compare 2026-10-28