brokencube/fft
brokencube/fft is a PHP package for Fast Fourier Transform calculations, enabling conversion between time and frequency domains for signal processing, audio analysis, and numerical computing. Composer-installable and suited to lightweight FFT tasks.
This is a patch-level release (1.0.1) with no API changes, so there is nothing new to learn before installing — but there is a clear signal about where the package's hot path lives: the polar/angular geometry layer that converts each data point into sin/cos coordinates. That class is the first thing to open when you start working with the package.
Minimal path in:
composer require the package and let Laravel's package discovery register the service provider.php artisan vendor:publish) and read it before writing any rendering code — dataset defaults, angular span, and precision usually live there rather than in method arguments.dump() the computed coordinates before touching the view layer. Confirming the angle → x/y mapping early saves hours of "why is my chart rotated" debugging later.First real use case: a single series built from a query (e.g. Model::query()->pluck('value')) rendered once, inside a controller or a small view component. Get that working end-to-end before adding a second series.
Build datasets from queries, not from the view. Map Eloquent results into plain arrays/collections in a dedicated method or action class. The package only cares about ordered numeric sequences; keeping the mapping explicit makes it trivial to test and to swap data sources.
Multi-series is where 1.0.1 pays off. The release memoizes sin/cos calls that repeat between datasets of the same length, yielding ~20% on iteration. That gain is realised when you render several series sharing the same point count — dashboards, comparison charts, small multiples. It does roughly nothing for a single large series, so if you are optimising one heavy chart, look at reducing point counts instead.
Pre-compute, then cache. For expensive pages, resolve the geometry in a queued job or a cached service method and store the computed series (or final SVG/JSON) with a cache key derived from the underlying data's updated_at. The package's internal trig cache is per-render and will not survive the request.
Keep series lengths aligned on purpose. If your UI supports toggling series, normalise them to a common length (pad or trim) before handing them over. This both makes the rendered output comparable and takes maximum advantage of the shared-angle caching.
Integration: in Livewire/Inertia, pass already-computed series arrays rather than models, so re-renders don't re-query. In Blade, wrap the render call in a component so caching and formatting stay in one place.
assertEqualsWithDelta) — memoised values can differ in the last bits.sin/cos order and a wrong angular offset look identical in the final output but differ at that intermediate step.How can I help you explore Laravel packages today?