-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
frontend/src/scenes/onboarding/sdks/feature-flags/laravel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { SDKKey } from '~/types' | ||
|
||
import { SDKInstallLaravelInstructions } from '../sdk-install-instructions' | ||
import { FlagImplementationSnippet } from './flagImplementationSnippet' | ||
|
||
export function FeatureFlagsLaravelInstructions(): JSX.Element { | ||
return ( | ||
<> | ||
<SDKInstallLaravelInstructions /> | ||
<FlagImplementationSnippet sdkKey={SDKKey.PHP} /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
frontend/src/scenes/onboarding/sdks/product-analytics/laravel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { CodeSnippet, Language } from 'lib/components/CodeSnippet' | ||
|
||
import { SDKInstallLaravelInstructions } from '../sdk-install-instructions' | ||
|
||
function LaravelCaptureSnippet(): JSX.Element { | ||
return ( | ||
<CodeSnippet language={Language.PHP}> | ||
{"PostHog::capture(array(\n 'distinctId' => 'test-user',\n 'event' => 'test-event'\n));"} | ||
</CodeSnippet> | ||
) | ||
} | ||
|
||
export function ProductAnalyticsLaravelInstructions(): JSX.Element { | ||
return ( | ||
<> | ||
<SDKInstallLaravelInstructions /> | ||
<h3>Send an Event</h3> | ||
<LaravelCaptureSnippet /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
frontend/src/scenes/onboarding/sdks/sdk-install-instructions/laravel.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { useValues } from 'kea' | ||
import { CodeSnippet, Language } from 'lib/components/CodeSnippet' | ||
import { apiHostOrigin } from 'lib/utils/apiHost' | ||
import { teamLogic } from 'scenes/teamLogic' | ||
|
||
function LaravelConfigSnippet(): JSX.Element { | ||
return <CodeSnippet language={Language.Bash}>composer require posthog/posthog-php</CodeSnippet> | ||
} | ||
|
||
function LaravelInstallSnippet(): JSX.Element { | ||
const { currentTeam } = useValues(teamLogic) | ||
|
||
return ( | ||
<CodeSnippet language={Language.PHP}> | ||
{`<?php | ||
namespace App\\Providers; | ||
use Illuminate\\Support\\ServiceProvider; | ||
use PostHog\\PostHog; | ||
class AppServiceProvider extends ServiceProvider | ||
{ | ||
public function boot(): void | ||
{ | ||
PostHog::init( | ||
'${currentTeam?.api_token}', | ||
[ | ||
'host' => '${apiHostOrigin()}' | ||
] | ||
); | ||
} | ||
} | ||
`} | ||
</CodeSnippet> | ||
) | ||
} | ||
|
||
export function SDKInstallLaravelInstructions(): JSX.Element { | ||
return ( | ||
<> | ||
<h3>Dependency Setup</h3> | ||
<LaravelConfigSnippet /> | ||
<h3>Configure</h3> | ||
<p> | ||
Initialize PostHog in the <code>boot</code> method of <code>app/Providers/AppServiceProvider.php</code> | ||
</p> | ||
<LaravelInstallSnippet /> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters