Category Archives: PHP

Multi tenancy in Laravel using stancl/tenancy

I spent a day inside stancl/tenancy (the database-per-tenant Laravel package) shipping a real change to a multi-tenant Software-as-a-Service (SaaS) application, and a few things finally clicked for me — none of which were obvious from the documentation alone. 💡 Here … Continue reading

Posted in Laravel, PHP | Tagged , , , , | Leave a comment

Moodle Plugin Development: version.php, install.xml, upgrade.php, and tasks.php Explained

Moodle is one of the largest Learning Management System (LMS) platforms in the world, and one of its quietly excellent superpowers is its plugin architecture. Every feature you can add — a new activity, a block, a report, an authentication … Continue reading

Posted in PHP | Tagged , , , | Comments Off on Moodle Plugin Development: version.php, install.xml, upgrade.php, and tasks.php Explained

Using PHP with Mustache: Practical Examples and Gotchas

If you want clean templates in PHP without pulling in a full framework, Mustache is a great fit. It keeps logic out of views, which forces you to prepare data in PHP first and makes templates easier to scan later. … Continue reading

Posted in PHP | Tagged , | Comments Off on Using PHP with Mustache: Practical Examples and Gotchas

Scribe for Laravel: API Docs That Stay Fresh, and a Calm Way to Upgrade Them

Most Laravel teams reach a point where their API documentation is either out of date, written somewhere it shouldn’t be (Confluence, anyone?), or just doesn’t exist. Scribe is the package that quietly fixes this — it reads your routes, controllers, … Continue reading

Posted in Laravel, PHP | Tagged , , | Comments Off on Scribe for Laravel: API Docs That Stay Fresh, and a Calm Way to Upgrade Them

Reading Laravel Config From a Queued Job — and the env() Trap That Bites You in Production

Today’s lesson came from a perfectly innocent-looking change in a Laravel app. We had a magic number — a chunk size — sprinkled across three call sites: 123foreach (array_chunk($userIds, 100) as $chunk) {     SendOnboardingEmailJob::dispatch($chunk); } One reviewer flagged … Continue reading

Posted in Laravel, PHP | Tagged , , | Comments Off on Reading Laravel Config From a Queued Job — and the env() Trap That Bites You in Production

When a Composer package vanishes from GitHub: don’t panic, and don’t delete vendor/

Today our CI/CD pipeline went red on a job that hadn’t been touched in months. The .gitlab-ci.yml was untouched. The branch built fine yesterday. composer install exploded. The relevant chunk of the failure log: 12345678Failed to download acme/some-nova-tool from dist: … Continue reading

Posted in PHP | Tagged , , , , | Comments Off on When a Composer package vanishes from GitHub: don’t panic, and don’t delete vendor/

Spatie activity_log: which method writes to which column? 🐘

If you’re using spatie/laravel-activitylog, you’ve probably written something like activity()->event(…)->log(…) a hundred times without thinking about where each piece lands in the database. The fluent API is friendly, but the column mapping isn’t obvious until you go look — so … Continue reading

Posted in PHP | Tagged , , , | Comments Off on Spatie activity_log: which method writes to which column? 🐘

The Null Coalescing Operator: A Small PHP Feature That Quietly Changed Everything

If you’ve been writing PHP for a while, you probably remember the days of nested „isset()” checks cluttering up every template and controller. Since PHP 7, there’s a much cleaner way — and if you haven’t fully embraced it yet, … Continue reading

Posted in PHP | Tagged | Comments Off on The Null Coalescing Operator: A Small PHP Feature That Quietly Changed Everything

BOLA in a Laravel Livewire app: when client-side state is the only thing standing between users and admin actions

A penetration test landed an interesting finding on a Livewire-powered admin panel I work on. The summary on the report read: Broken Object-Level Authorization (BOLA). A standard user can change a tenant-wide “who can access these assets” setting by replaying … Continue reading

Posted in Laravel, PHP | Tagged , , , , , , | Comments Off on BOLA in a Laravel Livewire app: when client-side state is the only thing standing between users and admin actions

PHP and CURL

1234567891011121314151617181920212223242526function browse($url, $postData = null) {     $fields = ”;     if(is_array($postData) && sizeof($postData) >= 1){         $fields = http_build_query($postData);     }     $ch = curl_init();     curl_setopt($ch, CURLOPT_URL, $url);     … Continue reading

Posted in PHP, Web Development | Comments Off on PHP and CURL