PHPackages                             larasense/static-site-generation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. larasense/static-site-generation

ActiveLibrary

larasense/static-site-generation
================================

define routes in your application with content that can be static generated either for performance issues or for simplicity.

v0.1.2(2y ago)05[1 issues](https://github.com/larasense/static-site-generation/issues)MITPHP

Since Jun 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/larasense/static-site-generation)[ Packagist](https://packagist.org/packages/larasense/static-site-generation)[ RSS](/packages/larasense-static-site-generation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (7)Versions (4)Used By (0)

Active development: Not ready for use
-------------------------------------

[](#active-development-not-ready-for-use)

This package is in active development.

Static Site Generation and Inmidiate Site Reconsiliation
--------------------------------------------------------

[](#static-site-generation-and-inmidiate-site-reconsiliation)

In some cases using all you resources or most of the services in the application infraestructure in every request is unnecessary. In some cases a page need to be generated only one time and it can be done as a deploy step.

Think in a eCommerce site: the landing page is the same for every visitor and the product page it also the same for every consumer. Now, we are not talking on a static only site like a documentation site, but application that the first render can be done once and only access the Databases or API's only if the user start to interact with it.

Instalation
-----------

[](#instalation)

```
composer require larasense/static-site-generation
```

Config
------

[](#config)

Add the Service provider to the end of the list of providers

```
// config/app.php

    'providers' => ServiceProvider::defaultProviders()->merge([
        /*
         * Package Service Providers...
         */

        /*
         * Application Service Providers...
         */
        App\Providers\RouteServiceProvider::class,
        Larasense\StaticSiteGeneration\StaticSiteGenerationServiceProvider::class,
    ])->toArray(),
```

How to use it
-------------

[](#how-to-use-it)

create a controller

```
php artisan make:controller HomeController
```

in the controller define the attributes to SSG or ISR

```
namespace App\Http\Controller;

use SSG;

class HomeController extends Controller
{

	[#SSG(url:'/')]
	public function index(Request $request)
	{
		// all processing
		// ...
		// and render the page
		return Inertia::render('product/Show', [
			'products'=> $products,
			'promos'  => $promotions,
			'Heros'   => $hero_images,
			// other info that the landing page must show
		]);
	}
}
```

and then use the command to generate the renders

```
php artisan SSG:generate
```

add this command to the CI/CD as a deploy step and you are good to go.

### Define path function

[](#define-path-function)

Some times the routes have some dynamic parameters. For those cases you can use the path function

In the controller define the attribute with the configuration

```
namespace App\Http\Controller;

use Josensanchez\LaravelSSG\Attributes;

class ProductController extends Controller
{
	/**
	 *
	 * url /product/{product}
	 */
	 [#SSG(paths: 'getStaticPath')#]
	public function show(Product $product)
	{
		// all processing
		return Inertia::render('product/Show', compact('product'));
	}

	/**
	 * it generate an array like [ 'product'=>1, 'product'=>2, 'product'=>3 ]
	 * and it will use it to generate the routes
	 *  /product/1
	 *  /product/2
	 *  /product/3
	 */
	public static function getStaticPath()
	{
		return Product::where('need_to_be_pre_render', true)
			->get()
			->map(fn ($product) => ['product' => $product->id]
			->toArray();
	}
}
```

Other configuration
-------------------

[](#other-configuration)

```
[#SSG(
	revalidate: integer,
	paths: String,
)#]

```

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~90 days

Total

3

Last Release

887d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d20abcc3b0cfec732595d5bc43fea75733237d12aae7a6994622b783fb129e39?d=identicon)[josensanchez](/maintainers/josensanchez)

---

Top Contributors

[![josensanchez](https://avatars.githubusercontent.com/u/5849818?v=4)](https://github.com/josensanchez "josensanchez (30 commits)")

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/larasense-static-site-generation/health.svg)

```
[![Health](https://phpackages.com/badges/larasense-static-site-generation/health.svg)](https://phpackages.com/packages/larasense-static-site-generation)
```

###  Alternatives

[tightenco/jigsaw

Simple static sites with Laravel's Blade.

2.2k438.5k29](/packages/tightenco-jigsaw)[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[riclep/laravel-storyblok

A Laravel wrapper around the Storyblok API to provide a familiar experience for Laravel devs

6272.7k4](/packages/riclep-laravel-storyblok)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
