Skip to content

slogsdon/php-web-component-ssr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

web-component-ssr

Provides server-side rendering support for native web components / custom elements

Features

Reasoning

PHP is easy to install, if not already present on you computer. PHP runs pretty much everywhere. PHP is flexible.

JavaScript is in a similar boat. It's readily available and flexible. Modern browser JavaScript is more than capable.

This project also scratches an itch to see how much PHP and JavaScript can work together to handle this problem domain.

Requirements

Running the demo

cd examples/simple && yarn install
cd ../.. && composer start

This will install a local copy of web-component-hydration and call the start Composer script defined in composer.json and execute the built-in PHP server.

On page load, PHP will output a template file as HTML. It will also prepare the client-side template. Once the DOM has loaded, the JavaScript will load the web component's custom element and replace all PHP created instances of the template with browser/JavaScript created instances.

License

This project is licensed under the MIT License. See LICENSE for details.

About

Provides server-side rendering support for native web components / custom elements

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages