Skip to content

Improve Documentation Routing & Fix All Internal Broken Links #185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ ChildProcess::stop('tail');
This will attempt to stop the process gracefully. The [`ProcessExited`](#codeprocessexitedcode) event will be
dispatched if the process exits.

Note that [persistent processes](/docs/desktop/1/digging-deeper/child-process#persistent-processes) will be permanently stopped and will only be restarted when the `start` method is called again. If you want to restart a persistent process, use the `restart` method instead.
Note that [persistent processes](/docs/digging-deeper/child-processes#persistent-processes) will be permanently stopped and will only be restarted when the `start` method is called again. If you want to restart a persistent process, use the `restart` method instead.

## Restarting a Child Process

Expand Down Expand Up @@ -271,11 +271,11 @@ A Child Process may send output via any of the following interfaces:
- A custom interface, e.g. a network socket.
- Broadcasting a Custom Event

`STDOUT`, `STDERR` & [Custom Events](/docs/desktop/1/digging-deeper/broadcasting#custom-events) are dispatched using
`STDOUT`, `STDERR` & [Custom Events](/docs/digging-deeper/broadcasting#custom-events) are dispatched using
Laravel's event system.

You may listen to these events by registering a listener in your app service provider, or on the front end
using the [Native helper](/docs/desktop/1/digging-deeper/broadcasting#listening-with-javascript).
using the [Native helper](/docs/digging-deeper/broadcasting#listening-with-javascript).

Please see the [Events](#events) section for a full list of events.

Expand Down
2 changes: 1 addition & 1 deletion resources/views/docs/desktop/1/getting-started/status.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ your ideas and questions through the [forum](https://github.com/orgs/nativephp/d
#### Can you sponsor?

If you're building an app that you plan to sell,
[can you sponsor the development of NativePHP](/docs/desktop/1/getting-started/sponsoring)? This will help us to continue
[can you sponsor the development of NativePHP](/docs/getting-started/sponsoring)? This will help us to continue
maintaining and supporting NativePHP.

</aside>
2 changes: 1 addition & 1 deletion resources/views/docs/mobile/1/concepts/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ care. If you choose to store them anywhere (either in a file or
## Secure Storage

NativePHP provides access to your users' device's native Keystore/Keychain through the
[`SecureStorage`](/docs/mobile/1/apis/secure-storage) facade, which
[`SecureStorage`](/docs/apis/secure-storage) facade, which
allow you to store small amounts of data in a secure way.

The device's secure storage encrypts and decrypts data on the fly and that means you can safely rely on it to store
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ NATIVEPHP_APP_VERSION_CODE="1"
```

Find out more about these options in
[Configuration](/docs/mobile/1/getting-started/configuration#codenativephp-app-idcode).
[Configuration](/docs/getting-started/configuration#codenativephp-app-idcode).

<aside class="relative z-0 mt-5 overflow-hidden rounded-2xl bg-pink-50 px-5 ring-1 ring-black/5 dark:bg-pink-600/10">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ php artisan native:run
- **Examples** - Check out the [Kitchen Sink demo app](https://play.google.com/store/apps/details?id=com.nativephp.kitchensinkapp)
on Android (coming soon to iOS!)

Ready to build your first mobile app with PHP? [Let's get started! 🚀](/docs/mobile/1/getting-started/introduction)
Ready to build your first mobile app with PHP? [Let's get started! 🚀](/docs/getting-started/introduction)
27 changes: 18 additions & 9 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,40 @@
Route::get('blog', [ShowBlogController::class, 'index'])->name('blog');
Route::get('blog/{article}', [ShowBlogController::class, 'show'])->name('article');

Route::redirect('/docs/{version}/{page?}', '/docs/mobile/{version}/{page?}')
->where('page', '(.*)')
->where('version', '[0-9]+');

Route::get('/docs/{platform}/{version}/{page?}', ShowDocumentationController::class)
->where('page', '(.*)')
->where('platform', '[a-z]+')
->where('version', '[0-9]+');
->where('version', '[0-9]+')
->name('docs.show');

// Forward unversioned requests to the latest version
Route::get('/docs/{page?}', function ($page = null) {
$page ??= 'introduction';
$version = session('viewing_docs_version', '1');
$platform = session('viewing_docs_platform', 'mobile');

$referer = request()->header('referer');

// If coming from elsewhere in the docs, match the current version being viewed
if (
! session()->has('viewing_docs_version')
&& parse_url($referer, PHP_URL_HOST) === parse_url(url('/'), PHP_URL_HOST)
parse_url($referer, PHP_URL_HOST) === parse_url(url('/'), PHP_URL_HOST)
&& str($referer)->contains('/docs/')
) {
$version = Str::before(ltrim(Str::after($referer, url('/docs/')), '/'), '/');
$path = Str::after($referer, url('/docs/'));
$path = ltrim($path, '/');
$segments = explode('/', $path);

if (count($segments) >= 2 && in_array($segments[0], ['desktop', 'mobile']) && is_numeric($segments[1])) {
$platform = $segments[0];
$version = $segments[1];
}
}

return redirect("/docs/{$version}/{$page}");
return redirect()->route('docs.show', [
'platform' => $platform,
'version' => $version,
'page' => $page,
]);
})->name('docs')->where('page', '.*');

Route::get('/order/{checkoutSessionId}', App\Livewire\OrderSuccess::class)->name('order.success');