Stripe Elements is inherently browser code, so it cannot run in PHP. StripeKit ships an optional companion frontend module you serve alongside your PHP backend, and it never touches your PHP process.Serve resources/js/stripekit-elements.js from the package alongside your app and import it only on the pages that need it.
A clientSecret is returned by $kit->payments->create() or $kit->checkout->create() whenever the resolved flow is elements, either because mode was set to 'elements' on init, or because mode: 'both' was configured and 'elements' was passed per call. See Choosing a mode.