nikic

Activity

Stars and mentions · Last 30 days, Oct 7 – Nov 5

GitHub stars15
Mentions0
01234Oct 7Oct 21Nov 5
UTC days · repositories nikic owns2 repositories

Top repositories

nikic’s repositories ranked by pull request authors, as on trending.

Loading

Contributes to

Repositories outside nikic’s account where nikic opened or reviewed pull requests in the past 365 days.

Who noticed nikic

Everyone who starred or forked nikic’s repositories since the archive began in 2011.

Notable accounts

Ordered by the stars their own repositories have received.

Biggest fans

Accounts that starred the most of these repositories.

Breakout weeks

Each repository’s best week of new stars, with the release published around it.

Mentions

1post
Nov 61 post
  1. How I built a request tracer for Laravel without a PHP extension When a page in a Laravel app is slow, the usual tools tell you that it was slow. I wanted to know which function and which query made it slow, and which line of my code ran that query. So I built a tool for it: BlastRadius, my first open-source package. !BlastRadius overview What it does You install it, open /blast-radius in your browser, and use your app normally. For each page you open, it shows: - the API calls the page made - a timeline of your own functions and database queries, with time and rows returned - which query failed, and the line of your code that ran it !Live requests When something fails, the page turns red and shows the exception, the failing query and where it was called from: !A failed request It also has a Code flow tab that draws how your routes, jobs and events reach your functions, and a command that looks at a git change and lists the routes it could affect and the tests to run. The interesting part: tracing without a PHP extension Profilers like Xdebug or Blackfire hook into PHP itself, which means installing an extension. I wanted composer require --dev and nothing else, so BlastRadius does three things in plain PHP. 1. It rewrites your methods as they load. A small autoloader runs before Composer's. For classes in your app folder it loads a rewritten copy where every method reports to a tracer: // before public function pay() { /* your code */ } // after (all on the same line, so line numbers don't move) public function pay() { $__br = Tracer::enter('Payments::pay'); try { /* your code */ } catch (\Throwable $__be) { Tracer::fail($__br, $__be); throw $__be; } finally { Tracer::leave($__br); } } The rewriting is done on the token level and keeps every line where it was, so stack traces and error messages still point at the right place. The copies are saved by a hash of the file's contents, so editing a file simply creates a new copy. If a rewrite ever produces invalid PHP, the loader falls back to your original file, so the worst case is "not timed", not "broken page". 2. It wraps the database connection. Laravel lets you register your own connection class per driver. BlastRadius registers a thin subclass that counts the rows each query returned or changed, and records failures, so you see "this query returned 27,313 rows in 293 ms" next to the function that called it. 3. It records each request in a middleware. When the request ends, the function timeline, the queries and any exception are saved in a small SQLite file (the last 300 requests). The page then groups them by the page that made them, using the Referer header. The "what can this break" half For a git diff, BlastRadius parses your code with php-parser, builds a call graph, and follows callers back to routes, jobs and commands. Every link has a confidence: CONFIRMED (the code says so), POSSIBLE (a guess from names) or UNRESOLVED (dynamic calls, reported instead of silently dropped). A path is only as certain as its weakest link. What it can't do (yet) - It's a development tool. It stays off in production unless you turn it on on purpose. - It times your own code, not vendor packages. - It records how many values a query bound, not the values themselves. - Dynamic calls ($class::$method()) show up as unresolved, not guessed. - It's an early release (0.1.x), tested on Laravel 8 to 12 and PHP 8.1 to 8.4. I've used it on a few apps, so expect rough edges. Try it composer require --dev idrees-saifuddin/blast-radius Then open http://your-app.test/blast-radius. Source and docs: Idrees-Saifuddin/blast-radius If you try it, I'd really like to know what breaks and what's missing. Open an issue or leave a comment here.

Achievements

Awards earned by the repositories nikic owns. Select an award to embed its badge.

Gold
01st place finishes
Silver
02nd place finishes
Bronze
13rd place finishes
Awarded repositories
1Owned by nikic now

Repositories

Ordered by gold, then silver, then bronze.

  1. PHP-ParserBest: 3rd by stars, 108 stars001

Every award

Top-three finishes of these repositories in completed trending days and weeks, newest first.

  1. PHP-Parser

A repository earns an award for finishing first, second or third in a completed trending day or week, ranked by new stars, new forks or pull request authors. Awards follow a repository through renames and transfers and count toward its current owner. Weeks run Monday to Sunday, UTC.