panique / mini3

Just an extremely simple naked PHP application, useful for small projects and quick prototypes.
274 stars 100 forks source link

Modernize footer.php #49

Open mhco opened 6 years ago

mhco commented 6 years ago

Updated jQuery version (1.11.1 was from May 2014), capitalized Javascript "url" variable to be more in line with the PHP constant, and updated <?php echo URL; ?> to the shorthand <?=URL?> that is standard as of PHP 5.4

mhco commented 6 years ago

You can't see it in the commit message, but one of the changes is that I changed:

<?php echo URL; ?>

to

<?=URL?>

which was made standard in PHP 5.4, and, since Mini3 requires PHP 5.6, this should be standard amongst all installations of Mini3.

wbitholedotbe commented 1 year ago

For readability and understanding... Shortcode is an absolute NO GO...

mhco commented 1 year ago

What? It's literally in PSR-1 right at the top. It's literally the first bullet point of the first section of the first standard. If you're a PHP developer and you can't read <?=$var?> then you need to update your training, as PSR is the standard to make PHP readable and understandable across developers, and they agree that it's one of the only two allowable ways to declare standardized modern PHP code.

https://www.php-fig.org/psr/psr-1/

crystlbrd commented 1 year ago

I‘m on @mhco site. Those are common shortcut tags and used for echoing something (<?php echo … ?>).

And as he mentioned, they belong to the specification and aren‘t disabled by default (in contrary to the <? ?> short tags).

I’m not even sure if you even can disable them.

mhco commented 1 year ago

@crystlbrd Not only can you not disable <?= but it's been decoupled from short_open_tags since 5.4.0 in early 2012. It's been a standard for over a decade, now. In fact, PHP.net specifically recommends using it:

As short tags can be disabled it is recommended to only use the normal tags (<?php ?> and <?= ?>) to maximise compatibility.

Source: https://www.php.net/manual/en/language.basic-syntax.phptags.php

Of all of the things in Mini3 or even my personal work to contest, using <?= is one of the last things to raise concern with. That said, if someone doesn't like the user of the short echo tag for some reason, they are totally free to replace it, but it's good and valid programming, so there's no logical reason to disallow it. I would argue it actually makes the code cleaner and easier to read, which is why I submitted this PR in the first place, but that might just be me.

BeardyMike commented 9 months ago

@crystlbrd & @mhco MIN3 states that it's simple application for small projects. As a newbie PHP dev, this says to me that I shouldn't expect to find shortcodes or other "pro" tags.

Whilst you might not consider <?= ?> and other shortcodes as pro tags, consider that from the perspective of someone who isn't an advanced user, those tags don't tell me what they're doing. Where as a longer tag like <?php echo $var; ?> is SUPER clear as to what it's doing. Let's not forget that this is a publicly available project, where readability and accessibility are king.

crystlbrd commented 9 months ago

Hey @BeardyMike,

thank you for your comment and opinion.

Sadly this projects seems to be abandoned by @panique, considering the last approved pull request was in late 2021 and since then they weren't really active on GitHub. This pull requests alone was opened in 2018...

But to your comment: I think it's more a question of taste, if you want to use the <?= ?> short tags or not. As discussed previously it's part of the PSR (defined in PSR-1 and I quickly checked PSR-2 and PSR-12 and couldn't find additions regards that) and therefor there is nothing wrong about using it.

I wouldn't even consider it a "pro" tag. You already searched for a framework and chose MINI3, which itself uses objects, models and a basic routing system. Quickly googling for "what does <?= do in PHP" and getting the result "it's basically a short tag for echo" can be expected at this point. And it's definitely not bad for your learning path.

I would even argue we should definitely use the short tag, since it makes new programmers aware of this feature.

But you could add a comment line like // the same as <?php echo "..." ?>.

That's just my opinion. And since panique will probably not comment this discussion nor merge this request, there is no real use in arguing about it.

BeardyMike commented 9 months ago

Hi @crystlbrd,

// the same as <?php echo "..." ?> - Noted.

panique commented 9 months ago

Hey hey everybody ;) I'm still there! I am not sure if we should add changes to such an old project, especially if the changes are not really really necessary. Also the changes and the documentation (in the readme file and inside different tutorials on the web) are not fitting together then. What do you think?

mhco commented 9 months ago

@panique I 100% agree. Any updating that would be needed is also a fun project for developers, anyway. Unless there are security vulnerabilities that are super apparent, there's no need to update the project anymore, especially for tiny changes like this one.

Thanks for the awesome project, though. It is still a great starting place for so many projects that don't need every fancy feature of the bigger frameworks. It's far more maintainable, too.

crystlbrd commented 9 months ago

Hey @panique, nice to hear from you :)

Regarding the changes:

Thanks for the awesome project, though. It is still a great starting place for so many projects that don't need every fancy feature of the bigger frameworks. It's far more maintainable, too.

It seems like this project is still something unexperienced PHP developer are finding and using as a starting point to learn more about frameworks. I myself switched to Symfony years ago, but I feel MINI is still a great starting point, if a more sophisticated framework is overwhelming for you.

That said, I think the simple and bare bone structure of this project is its core selling point. Any additional "fancy feature" are done way better by the bigger frameworks then we could recreate here. Also, it's not too difficult to implement e.g. Twig or Doctrine into MINI, if required.

Keeping this pack up to date seems to be the way to go.

BeardyMike commented 9 months ago

Just gonna raise my "new dev" flag and say that I'd love to see this project maintained.

It's been invaluable in learning how PHP works, and seeing the smaller things (jQuery, short codes, etc) being sorted helps to ease the cognitive load on a new dev. I had no idea that <?="123"?> was an option, but having a quick comment after it "Echo out "123" would be an enormous help.

TL:DR - This is a vote in favour of maintaining.