Simo Jakovic

41 posts

Simo Jakovic

Simo Jakovic

@simo_jakovic

เข้าร่วม Eylül 2025
13 กำลังติดตาม8 ผู้ติดตาม
Simo Jakovic
Simo Jakovic@simo_jakovic·
That's a wrap on PHP Package Development. 12 posts covering: - Package basics + Composer setup - Testing with PHPUnit/Pest - Publishing to Packagist - Laravel package integration - Symfony bundle development Full series on jakovic.com If you build a package after reading this, tag me. I want to see it. #php #opensource #laravel #symfony #packagedevelopment
English
0
0
0
24
Simo Jakovic
Simo Jakovic@simo_jakovic·
Symfony bundles are more structured than Laravel packages. - Bundle class - DI Extension - Configuration with TreeBuilder - services.yaml More verbose? Yes. More explicit? Also yes. Symfony makes you think about your architecture upfront. PHP Package Development (11/12) on jakovic.com #php #symfony #bundles
English
0
0
1
15
Simo Jakovic
Simo Jakovic@simo_jakovic·
Testing Laravel packages without a Laravel app: Orchestra Testbench gives you a full Laravel environment in your test suite. Test routes, commands, views, config - everything, without a real project. If it works in Testbench, it works in production. PHP Package Development (10/12) on jakovic.com #php #laravel #testing
English
0
0
0
11
Simo Jakovic
Simo Jakovic@simo_jakovic·
Level up your Laravel package: - Blade components for reusable UI - Migrations that publish cleanly - Artisan commands users can run - Middleware for request handling - Facades for clean syntax TextToolkit::slugify() just hits different as a facade. PHP Package Development (9/12) on jakovic.com #php #laravel #webdev
English
0
0
1
13
Simo Jakovic
Simo Jakovic@simo_jakovic·
Building a Laravel package? Start with the ServiceProvider. class TextToolkitServiceProvider extends ServiceProvider { public function boot() { $this->publishes([...]); } } Package discovery, config publishing, views - Laravel makes it smooth. PHP Package Development (8/12) on jakovic.com #php #laravel #packages
English
0
0
1
12
Simo Jakovic
Simo Jakovic@simo_jakovic·
The driver pattern makes packages extensible: $toolkit = new TextToolkit(); $toolkit->addDriver('markdown', new MarkdownDriver()); Users can swap implementations without touching your code. This is how Laravel's filesystem supports S3, local, FTP from one API. PHP Package Development (7/12) on jakovic.com #php #designpatterns #architecture
English
0
0
0
10
Simo Jakovic
Simo Jakovic@simo_jakovic·
Nobody installs a package with no README. Quality checklist: - Clear README with install + usage - LICENSE file (MIT is fine) - CHANGELOG for updates - PHPStan for static analysis - Pint for code style - GitHub Actions for CI First impressions matter on Packagist. PHP Package Development (6/12) on jakovic.com #php #opensource #codequality
English
0
0
1
17
Simo Jakovic
Simo Jakovic@simo_jakovic·
From local code to composer require: git tag v1.0.0 git push origin v1.0.0 Submit to Packagist. Done. Semantic versioning matters: - MAJOR: breaking changes - MINOR: new features - PATCH: bug fixes Your package is now installable worldwide. PHP Package Development (5/12) on jakovic.com #php #packagist #composer #opensource
English
0
0
0
5
Simo Jakovic
Simo Jakovic@simo_jakovic·
Your package has no tests? Then it has no users. $this->assertEquals( 'hello-world', TextToolkit::slugify('Hello World!') ); PHPUnit or Pest - pick one, but test everything. Cover edge cases. Run them in CI. Untested packages are liabilities. PHP Package Development (4/12) on jakovic.com #php #testing #phpunit #pest
English
0
0
0
18
Simo Jakovic
Simo Jakovic@simo_jakovic·
Building a real package, not a tutorial toy. TextToolkit::slugify('Hello World!'); // hello-world TextToolkit::truncate('Long text here...', 50); // Smart word-boundary truncation Interfaces first. Implementation second. That's how you build packages people actually trust. PHP Package Development (3/12) on jakovic.com #php #cleancode #packagedevelopment
English
0
0
0
5
Simo Jakovic
Simo Jakovic@simo_jakovic·
Setting up a PHP package from scratch: mkdir text-toolkit && cd text-toolkit composer init The key files: - composer.json (autoloading + metadata) - src/ (your code) - tests/ (your tests) PSR-4 autoloading maps namespaces to directories. Get this right and everything else follows. PHP Package Development (2/12) on jakovic.com #php #composer #devtools
English
0
0
0
15
Simo Jakovic
Simo Jakovic@simo_jakovic·
Stop copying that helper class between projects. Build a package instead: - Reusable across all your projects - Versioned with Composer - Testable in isolation - Shareable with the community New blog series: PHP Package Development (1/12) on jakovic.com #php #composer #opensource #packagedevelopment
English
0
0
0
10
Simo Jakovic
Simo Jakovic@simo_jakovic·
console.log('1'); setTimeout(() => console.log('2'), 0); Promise.resolve().then(() => console.log('3')); console.log('4'); Output: 1, 4, 3, 2 Microtasks (Promises) run BEFORE macrotasks (setTimeout), even with 0ms delay. #javascript #eventloop #async
English
0
0
0
1
Simo Jakovic
Simo Jakovic@simo_jakovic·
Can you prevent an object from being cloned in PHP? class Singleton { private function __clone() {} } clone $obj; // Fatal error Most devs know __construct. But __invoke, __clone, __debugInfo - these separate juniors from seniors. #php #oop #designpatterns
English
0
0
0
6
Simo Jakovic
Simo Jakovic@simo_jakovic·
NaN === NaN is false in JavaScript. Not a bug. By design (IEEE 754). How to check for NaN: - Number.isNaN(value) - reliable - isNaN(value) - careful, isNaN('hello') returns true Details like this separate mid from senior. #javascript #webdev #interviewquestions
English
0
0
0
4
Simo Jakovic
Simo Jakovic@simo_jakovic·
?? vs ?: in PHP: $a = 0; echo $a ?: 'fallback'; // 'fallback' echo $a ?? 'fallback'; // 0 ?: checks if falsy. ?? checks only if null. Mixing these up = bugs in production. #php #programming #interviewprep
English
0
0
0
1
Simo Jakovic
Simo Jakovic@simo_jakovic·
What gets logged? for (var i = 0; i < 3; i++) { setTimeout(() => console.log(i), 1000); } Not 0, 1, 2. Answer: 3, 3, 3 var is function-scoped. By the time setTimeout fires, i is already 3. Fix: use let. #javascript #closures #interviewtips
English
0
0
0
0
Simo Jakovic
Simo Jakovic@simo_jakovic·
The N+1 query problem: Fetch 100 users. Then fetch posts for each. That's 101 queries instead of 2. Fix: User::with('posts')->get() Have you ever caught an N+1 in production? #php #laravel #database #performance
English
0
0
0
8