phpStageManager
template
phpStageManager | template | |
---|---|---|
1 | 4 | |
2 | 485 | |
- | - | |
10.0 | 5.4 | |
over 8 years ago | about 1 month ago | |
PHP | TypeScript | |
- | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
phpStageManager
-
That people produce HTML with string templates is telling us something
"Nobody ever generates JSON using string interpolation." Oh boy, you just took me back to my first ever PHP project. Feast your eyes: https://github.com/oxguy3/phpStageManager/blob/master/events...
This file generates a feed of events (rehearsals for my high school play) to be rendered by the FullCalendar JS plugin. FullCalendar required a particular data schema that didn't match the format of my MySQL table, which meant I couldn't just json_encode() the MySQL results. I guess I just didn't conceptualize that I could create a new object that matched the FullCalendar format, and then call json_encode(). So, I generated JSON with strings.
Honestly it's a toss-up whether the JSON generation is the worst thing about this file. It looks like I also made a separate database query for every single row to get the username, because I apparently didn't know how to do joins. Could probably spend an hour listing some of the other little nuggets of awful in there. But hey, it got the job done! :)
template
-
That people produce HTML with string templates is telling us something
I’ve been using to avoid the whole “create DOM elements in JS” thing, and it’s been working well so far:
https://github.com/retrohacker/template
- Template – A simple framework for webapps
- Template – A Simple Framework for Webapps
-
React.dev
This is exactly what I'm doing with my personal "framework" I use for client contracts. It's just Web Components with a handy class based wrapper. I call it Template, since it's based off tags.
It's a joy to work in, feels "frameworky" but it's standard web standards with <100 lines of convenience JS wrapped around it. There is no magic beyond what the browser provides - I like I like it that way.
https://github.com/retrohacker/template/
It's "open source" as a reference. Just using it for myself. There aren't many docs beyond notes to myself. You're welcome to kick the tires. If you like it I'd entertain PRs and stuff but it's such a small library forking is probably entirely reasonable to make your own flavor too.
Cheers and happy hacking!
What are some alternatives?
vtpl - Vtpl is a php template engine that ensures proper separations of concerns, the frontend logic is separated from presentation. The goal is to keep the html unchanged for better maintainability for both backend and frontend developers
nano - 🎯 SSR first, lightweight 1kB JSX library.
dream-html - Render HTML, SVG, MathML, htmx markup from your OCaml Dream backend server
literal-html - Simple and unsafe HTML/XML templates for TypeScript, using tagged template literals
dominate - Dominate is a Python library for creating and manipulating HTML documents using an elegant DOM API. It allows you to write HTML pages in pure Python very concisely, which eliminate the need to learn another template language, and to take advantage of the more powerful features of Python.
jsonnet - Jsonnet - The data templating language
htmlgo - A library for writing type-safe HTML in Golang
flog - Pre-Markdown static site generator based on UNIX tools and XSL
rfcs - RFCs for changes to React
gron - Make JSON greppable!
helix - A simple, easy to use library for React development in ClojureScript.