I never liked mixing html and PHP, so I created Pure, I hope you like it too

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1919
    Jess_Pinkman
    Participant

    Pure is similar to react in the sense that I can create reusable components.

    It also makes my code more clean and readable.

    Feedbacks would be appreciated.

    [https://github.com/JessPinkman/Pure](https://github.com/JessPinkman/Pure)

    composer require jesspinkman/pure

    #1920
    colshrapnel
    Guest

    To me, this approach *is* the very mixing of html and PHP.

    Some obvious drawbacks are:

    – there are frontend devs who are a HUGE relief to us backend folks, taking up all the hassle with those tags and attributes. Now with Pure I got to translate every single HTML tag into a PHP code
    – and then translate again when some changes to the design arrive
    – there are powerful code inspectors for HTML too. Suppose none of them ever heard of your PHPTML
    – now again some changes in the design and I got to find them in the source HTML files, and mash them into Puree
    – none of the examples feature the JS. And I fear to see it in action.
    – did I mention the small changes in the design that frontend dev would have been happy to do by himself, if only this approach weren’t used?

    #1921
    g105b
    Guest

    Projects like this are great for training your PHP muscles. If you can push this to a polished version, I’m all for seeing you succeed. I do, however, concur with the general feedback in this thread, that the project seems to actually make the coupling between PHP and HTML even tighter.

    #1922
    Jess_Pinkman
    Guest

    Well, I got bashed pretty badly lol

    Some context:

    – I am self-taught developer (started 2 years ago)

    – I mainly use wordpress, which has no native templating system.

    – In my projects, all my views (=components / sub-components) are stored in a a specific folder (Views), so I do feel that I am splitting my views/controllers/models. A controller just calls whatever view is necessary, and passes along variables in the constructor. Genuine question, isn’t it the same concept as twig (which I never used) ?

    – I still didn’t manage to make my wsl2/docker/vscode setup work with xdebug/phpunit, hence no testing, which I know is lacking.

    – my projects are all full stack, no front end/back end guy.

    – I am not sure what your mean by no JS. I presume you are talking about javascript files, which are simply loaded via a script tag. I guess I am missing a part of the picture here

    ​

    Thanks for the feedbacks.

    #1923
    greenville008
    Guest

    Why did you make this if you don’t like mixing html and PHP?

    #1924
    codemunky
    Guest

    You won’t receive any love for that here I’m afraid. I created something similar myself a while ago—and still use some small portions of it from time to time—but the community here is all about good software practices. Separation of concerns, model/view architecture, templates, etc etc, and will be against this as it’s semantically really no different to directly echoing out html.

    I’m a *bit* past coding like this… 95%+ of this community are **light-years** past it.

    #1925
    Huliek
    Guest

    I like this approach a lot better than a fully different language like Twig.

    I created a similar POC https://gitlab.com/erikvv/hyperscript-php

    #1926
    eurosat7
    Guest

    This package has no test. ;-P

    And it has no real use. The only usage it had was programming it.

    Step it up: Write your own coding language having parser, lexer and linter. You will find out about operators and priority and ambiguous syntax problems. It can be a lot of fun.

    #1927
    Anonymous
    Guest

    Can someone explain what the better alternative to this is?

    I see multiple comments saying that “people are past this” or “html and php should be even less coupled.”
    I’m not sure what people mean by that and I’m genuinely curious.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.