1+ import { useEffect , useState } from 'react' ;
12import Link from '@docusaurus/Link' ;
23import CodeBlock from '@theme/CodeBlock' ;
4+ import { PLATFORMS , detectPlatform } from '@site/src/lib/installer' ;
35import styles from './styles.module.css' ;
46
5- const quickStartSnippet = `# php.ini
6- zend_extension=php_debugger
7+ function quickStartSnippet ( command ) {
8+ return `# Install\n${ command } \n\n# Debug\nphp your-script.php` ;
9+ }
10+
11+ /* Shows the command for the visitor's own OS. The page is prerendered without
12+ knowing it, so this starts on the Unix command and corrects itself after
13+ mounting -- detecting in an effect rather than during render keeps the first
14+ client render identical to the server's, which is what hydration compares. */
15+ function QuickStartSnippet ( ) {
16+ const [ platform , setPlatform ] = useState ( 'macos' ) ;
17+
18+ useEffect ( ( ) => {
19+ const detected = detectPlatform ( ) ;
20+ if ( detected ) {
21+ setPlatform ( detected ) ;
22+ }
23+ } , [ ] ) ;
24+
25+ const active = PLATFORMS . find ( ( p ) => p . id === platform ) ?? PLATFORMS [ 0 ] ;
726
8- # Run your script
9- XDEBUG_TRIGGER=1 php your-script.php` ;
27+ return (
28+ < CodeBlock language = { active . language } >
29+ { quickStartSnippet ( active . command ) }
30+ </ CodeBlock >
31+ ) ;
32+ }
1033
1134const keyFeatures = [
12- 'Interactive CLI debugger ' ,
13- 'Breakpoints & conditional breakpoints ' ,
14- 'Step over, into, and out ' ,
15- 'Inspect variables and expressions ' ,
16- 'Exception handling ' ,
17- 'Logging and error handling ' ,
35+ 'Always on — no trigger to set ' ,
36+ 'Near-zero overhead when idle ' ,
37+ 'Line, conditional and exception breakpoints ' ,
38+ 'Step into, over and out ' ,
39+ 'Inspect variables across the call stack ' ,
40+ 'Watch expressions and live value edits ' ,
1841] ;
1942
20- const ides = [ 'PhpStorm' , 'VS Code' ] ;
43+ const ides = [ 'PhpStorm' , 'VS Code' , 'Any other editor with PHP debugging' ] ;
2144
2245function Card ( { icon, title, children, linkTo, linkLabel} ) {
2346 return (
@@ -42,8 +65,9 @@ export default function HomeCards() {
4265 title = "Quick Start"
4366 linkTo = "/getting-started/quick-start"
4467 linkLabel = "View quick start guide" >
45- < p > Get up and running in seconds.</ p >
46- < CodeBlock language = "ini" > { quickStartSnippet } </ CodeBlock >
68+ < p > Install it. There is nothing to configure.</ p >
69+ < QuickStartSnippet />
70+ < p > Start your editor listening, set a breakpoint, run your code.</ p >
4771 </ Card >
4872 < Card
4973 icon = {
0 commit comments