<section id="in-memory-page-methods">

<!-- Start generated docs for Hyde\Pages\InMemoryPage -->
<!-- Generated by HydePHP DocGen script at 2023-03-10 20:57:31 in 0.46ms -->

#### `make()`

Static alias for the constructor.

```php
InMemoryPage::make(string $identifier, Hyde\Markdown\Models\FrontMatter|array $matter, string $contents, string $view): static
```

#### `__construct()`

Create a new in-memory/virtual page instance.

The in-memory page class offers two content options. You can either pass a string to the $contents parameter, Hyde will then save that literally as the page&#039;s contents. Alternatively, you can pass a view name to the $view parameter, and Hyde will use that view to render the page contents with the supplied front matter during the static site build process.

Note that $contents take precedence over $view, so if you pass both, only $contents will be used. You can also register a macro with the name &#039;compile&#039; to overload the default compile method.

If the identifier for an in-memory page is &quot;foo/bar&quot; the page will be saved to &quot;_site/foo/bar.html&quot;. You can then also use the route helper to get a link to it by using the route key &quot;foo/bar&quot;. Take note that the identifier must be unique to prevent overwriting other pages. all this data will be passed to the view rendering engine.
- **Parameter $view:** The view key or Blade file for the view to use to render the page contents.
- **Parameter $matter:** The front matter of the page. When using the Blade view rendering option,


```php
$page = new InMemoryPage(string $identifier, \Hyde\Markdown\Models\FrontMatter|array $matter, string $contents, string $view): void
```

#### `getContents()`

Get the contents of the page. This will be saved as-is to the output file when this strategy is used.

```php
$page->getContents(): string
```

#### `getBladeView()`

Get the view key or Blade file for the view to use to render the page contents when this strategy is used.

```php
$page->getBladeView(): string
```

#### `compile()`

Get the contents that will be saved to disk for this page.

In order to make your virtual page easy to use we provide a few options for how the page can be compiled. If you want even more control, you can register a macro with the name &#039;compile&#039; to overload the method, or simply extend the class and override the method yourself, either in a standard or anonymous class.

```php
$page->compile(): string
```

#### `macro()`

Register a macro for the instance.

Unlike most macros you might be used to, these are not static, meaning they belong to the instance. If you have the need for a macro to be used for multiple pages, you should create a custom page class instead.

```php
$page->macro(string $name, callable $macro): void
```

#### `hasMacro()`

Determine if a macro with the given name is registered for the instance.

```php
$page->hasMacro(string $method): bool
```

#### `__call()`

Dynamically handle macro calls to the class.

```php
$page->__call(string $method, array $parameters): mixed
```

<!-- End generated docs for Hyde\Pages\InMemoryPage -->

</section>
