PHPackages                             handmadeweb/frosty - 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. handmadeweb/frosty

ActiveLibrary

handmadeweb/frosty
==================

1.1.8(2y ago)0338[1 issues](https://github.com/HandmadeWeb/frosty/issues)MITJavaScriptPHP ^8.0

Since Aug 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/HandmadeWeb/frosty)[ Packagist](https://packagist.org/packages/handmadeweb/frosty)[ RSS](/packages/handmadeweb-frosty/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (13)Used By (0)

[![MIT Licensed](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

Frosty provides easy access to fetch Ajax content in Statamic.

Requirements
------------

[](#requirements)

- PHP 8.0 or higher
- Statamic 3.1 or higher

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require handmadeweb/frosty
```

### Copy the package config to your local config with the publish command:

[](#copy-the-package-config-to-your-local-config-with-the-publish-command)

```
php artisan vendor:publish --tag="config" --provider="HandmadeWeb\Frosty\ServiceProvider"
```

### Prepare for Usage

[](#prepare-for-usage)

#### Native Method

[](#native-method)

If you aren't using Alpine Js in your application then you'll need to load [handmadeweb/datafetcher.js](https://github.com/HandmadeWeb/datafetcher.js) in your footer, you can either do this manually, or via the provided helpers for Alpine: `{{ frosty:scripts }}`, Blade: `@frostyScripts` or PHP: `\HandmadeWeb\Frosty\Frosty::scripts();`

This method uses the `native.blade.php` view, you are free to override it in `resources/vendor/frosty/`, you will have access to the `content`, `endpoint` and `mode` variables.

#### Alpine.Js Method

[](#alpinejs-method)

If you are using Alpine.Js in your application then you may update your Frosty configuration to use Alpine.

```
/*
* Mode
*
* Which mode to use?
*
* native: uses https://github.com/handmadeweb/datafetcher.js
* - If you aren't using Alpine Js in your application then you'll need to load handmadeweb/datafetcher.js in your footer.
* - You can either do this manually, or via the provided helpers for Alpine: `{{ frosty:scripts }}`
* - Blade: `@frostyScripts` or PHP: `\HandmadeWeb\Frosty\Frosty::scripts();`
*
* alpine: uses Alpine.Js, be sure to load it.
*/
'mode' => 'alpine',
```

This method uses the `alpine.blade.php` view, you are free to override it in `resources/vendor/frosty/`, you will have access to the `content`, `endpoint` and `mode` variables.

#### Custom Method

[](#custom-method)

You are free to use a custom method, you may do so by defining a new view template for Frosty to use under `resources/vendor/frosty`, the filenames `alpine`, `native` and `not-found` are considered to be reserved, although you may override them if you wish.

Once you have created a new view for your mode, you will have access to the `content`, `endpoint` and `mode` variables, you may then use this to provide the content or endpoint to your custom method.

Then it is just a matter of updating the mode to use the name of your new method/view.

Lets say we created a file called `myCustomVueMode.blade.php` which might contain something like,

```

```

You would then update your mode to:

```
'mode' => 'myCustomVueMode',
```

In the event that your custom method/mode doesn't have a corresponding view file, then Frosty will insert some HTML comments in the location of where it would have rendered your method.

```

```

Antlers Usage
-------------

[](#antlers-usage)

Using Frosty in `Antlers` can be done by using the `frosty` tag or if you are using an `.antlers.php` template file by using the `class` (see class instructions)

You can use the tag as either `frosty:fetch` or just `frosty`, I like `frosty:fetch` a little more though as it describes what it is doing.

### Pulling in content from a url.

[](#pulling-in-content-from-a-url)

The url can be anywhere.

```
{{ frosty:fetch url="/ajax/signup-form" }}
```

Or

```
{{ frosty:fetch endpoint="/ajax/signup-form" }}
```

### Pulling in content from a route.

[](#pulling-in-content-from-a-route)

Routes must be a GET route and cannot currently accept parameters.

```
{{ frosty:fetch route="ajax.signup-form" }}
```

Please note that the above three examples cannot be combined into a single tag call.

```
{{ frosty:fetch endpoint="/ajax/signup-form" url="/ajax/signup-form" route="ajax.signup-form" }}
{{ frosty:fetch route="ajax.signup-form" endpoint="/ajax/signup-form" url="/ajax/signup-form" }}
```

The first found parameter will be used, parameters are checked in the order: endpoint, url, route.

### Using initial content then pulling new content.

[](#using-initial-content-then-pulling-new-content)

This works with both the route and url options.

```
{{ frosty:fetch route="ajax.news" }}
    Finding something juicy!
{{ /frosty:fetch }}
```

### Using a different mode/view.

[](#using-a-different-modeview)

You are free to use any other mode/view that might be available for Frosty to use, separately to whatever you might have set as the config default. You can do this by passing the mode parameter, which will relate to the name of a view file located in `resources/vendor/frosty/`

```
{{ frosty:fetch route="ajax.news" mode="myCustomVueMode" }}
    Finding something juicy!
{{ /frosty:fetch }}
```

Blade Usage
-----------

[](#blade-usage)

Using Frosty in `Blade` can be done by using the `frosty` blade directive or by using the `class` (see class instructions) The blade directive currently doesn't accept providing content or context, If you need to use that functionality the you'll need to use the class chaining method.

```
@frosty(string $endpoint = null)
```

You can also use named arguments in PHP 8+ to specify particular parameters.

```
@frosty(endpoint: '/ajax/sponsors')
```

### Pulling in content from a url.

[](#pulling-in-content-from-a-url-1)

```
@frosty('/ajax/sponsors')
```

### Pulling in content from a route.

[](#pulling-in-content-from-a-route-1)

```
@frosty(route('ajax.sponsors', 'featured'))
```

### Using a different mode/view.

[](#using-a-different-modeview-1)

You are free to use any other mode/view that might be available for Frosty to use, separately to whatever you might have set as the config default. You can do this by passing the mode parameter, which will relate to the name of a view file located in `resources/vendor/frosty/`

```
@frosty(route('ajax.sponsors', 'featured'), 'myCustomVueMode')
```

Class Usage
-----------

[](#class-usage)

New up the class.

```
new Frosty(string $endpoint = null)
```

Or use the make method.

```
Frosty::make(string $endpoint = null)
```

You can also use named arguments in PHP 8+ to specify particular parameters.

```
$frosty = Frosty::make(endpoint: '/ajax/random-quote');
```

You are free to use any other mode/view that might be available for Frosty to use, separately to whatever you might have set as the config default. You can do this by passing the mode (or second) parameter, which will relate to the name of a view file located in `resources/vendor/frosty/`

```
$frosty = Frosty::make('/ajax/random-quote', 'myCustomVueMode');
// You are free to use the named argument style of mode: 'myCustomVueMode'
```

Aditional methods can be chained to add content and context, or to set the endpoint.

```
$frosty = Frosty::make();
$frosty->withContent($content); // string
$frosty->withContext($context); // \Statamic\Tags\Context or \Illuminate\Support\Collection (Used to provide Cascaded variables to the content)
$frosty->withEndpoint($endpoint); // string
```

When using the tag, you'll specify if the endpoint is a url or a route, however when using the class directly, the endpoint is assumed to be a url string, if you wish to pass a route to it instead, then you are welcome to do that.

Unlike when using the Frosty tag, the Frosty class can directly accept parameters on the route below.

```
Frosty::make(route('ajax.cart', $user->id())
// or
Frosty::make()->withEndpoint(route('ajax.cart', $user->id())
```

When you are ready to output the content, then you may call the render method.

```
Frosty::make()
    ->withContent($content) // Optional
    ->withContext($context) // Optional
    ->withEndpoint($endpoint) // Optional (could be set on class or make), If no endpoint has been set, then we won't bother trying to render.
    ->render();
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](https://statamic.com/addons/handmadeweb/frosty/release-notes) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/handmadeweb/frosty/blob/main/CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Handmade Web &amp; Design](https://github.com/handmadeweb)
- [Michael Rook](https://github.com/michaelr0)
- [All Contributors](https://github.com/handmadeweb/frosty/graphs/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/handmadeweb/frosty/blob/main/LICENSE) for more information.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% 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 ~64 days

Recently: every ~169 days

Total

12

Last Release

1037d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e7a98568b1db97131b747177e0460eac0afd7e5bb47569243f9656f5da2bc4f?d=identicon)[HandmadeWeb](/maintainers/HandmadeWeb)

---

Top Contributors

[![sliver37](https://avatars.githubusercontent.com/u/998827?v=4)](https://github.com/sliver37 "sliver37 (2 commits)")[![michaelr0](https://avatars.githubusercontent.com/u/54159303?v=4)](https://github.com/michaelr0 "michaelr0 (1 commits)")

### Embed Badge

![Health badge](/badges/handmadeweb-frosty/health.svg)

```
[![Health](https://phpackages.com/badges/handmadeweb-frosty/health.svg)](https://phpackages.com/packages/handmadeweb-frosty)
```

###  Alternatives

[statamic/statamic

Statamic

824170.4k](/packages/statamic-statamic)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[statamic/ssg

Generate static sites with Statamic.

254302.4k](/packages/statamic-ssg)[statamic/eloquent-driver

Allows you to store Statamic data in a database.

125598.8k7](/packages/statamic-eloquent-driver)[statamic/seo-pro

65440.7k](/packages/statamic-seo-pro)[rias/statamic-redirect

28298.4k](/packages/rias-statamic-redirect)

PHPackages © 2026

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