php-svelte

Php Svelte

PHP + Svelte + Phroute

PHP + Svelte + Phroute


What's in ?

A simple, basic and quick project to test and embed svelte components inside a php site.
Also, using phroute and caching for the controllers.

Main versions used so far :

  • PHP 7.4.32
    • Phroute 2.2
  • NPM 8.8.0
  • Node v16.15.0
    • Svelte 3.55
    • ESLint 8.31
    • Font Awesome 6
    • Tailwindcss 3.2.4
    • SASS 1.57
    • Rollup 3.7.5
    • Vite 4.0

No SvelteKit !

The goal

The goal is to use Svelte for the front, and keep PHP for the back. Svelte has to be multi-components, that could be use in PHP views.

Building stages

There is two main building stages for this :

  1. Building the site routes (phroute caching)
  2. Building the Svelte components (with rollup or vite)

Benchmark rollup & vite

$ /usr/bin/time --verbose --output=./benchmark-vite.time.txt make build-vite
$ /usr/bin/time --verbose --output=./benchmark-rollup.time.txt make build-rollup

Makefile

Some headache with make, as the project was done under wsl. That's why winshell is hard coded. Not a big deal to change for other os.
Got some troubles with /bin/sh and aliases to windows system, while everything works fine in command line...

server

The server runs the PHP internal server. Only for testing usage !!!
It means also there is not security at all on the server architecture. www/ directory should be the only document root of the site.

TODO

  • Implementing tailwind
  • Implementing svelte/store
  • Common js and css extracting

Top categories

Loading Svelte Themes