alessandrolai, to Symfony Italian
@alessandrolai@phpc.social avatar

This Friday I'll be speaking at @phpday 2024, this time about my long story with queues and, in particular, about #symfony Messenger.

See you there?
#php #phpday #phpday2024 #inSpritzWeTrust

opdavies, to drupal
@opdavies@mastodon.social avatar

Thanks to everyone who organised, volunteered or attended DrupalCamp Ghent (@drupalbe).

I had a great few days at this conference and my first time in Belgium!

For slides and previous recordings of my talks, go to https://opdavi.es/dcg.

#drupal #php #phpc

mobileatom, to php
@mobileatom@flipboard.com avatar
hashbangcode, to php
@hashbangcode@fosstodon.org avatar

New! Drawing A Parabolic Curve With Straight Lines In PHP

https://www.hashbangcode.com/article/drawing-parabolic-curve-straight-lines-php

A parabolic curve is a type of curve where every point is an equal distance from a focal point. There a number of different way to generate this sort of curve using maths, but one of the simplest is to use straight lines to create the illusion of the curve.

#php #phpGD2 #hashbangcode

mobileatom, to Symfony
@mobileatom@flipboard.com avatar
ramsey, to php
@ramsey@phpc.social avatar

I was looking at this Sass (SCSS) compiler, written in , and I noticed something very odd.

Under “requires (dev)," it requires two packages, sass/sass-spec and thoughtbot/bourbon, both of which appear to be empty packages, containing only a composer.json file, which has no dependencies.

What’s the purpose of these packages? They otherwise appear suspicious, to me, but I can’t see that they're doing anything nefarious right now—they just appear pointless.

https://packagist.org/packages/scssphp/scssphp

mobileatom, to php
@mobileatom@flipboard.com avatar

Cool features of Swiss Knife CLI package manager.

https://tomasvotruba.com/blog/cool-features-of-swiss-knife?utm_source=flipboard&utm_medium=activitypub

Posted into SYMFONY FOR THE DEVIL @symfony

sarah, to php
@sarah@phpc.social avatar

Who are my LGBTQ+ folks? Have an idea, would like feedback. 🏳️‍⚧️ 🏳️‍🌈

wyri, to php
@wyri@haxim.us avatar

Merged https://github.com/jakubkulhan/bunny/pull/147 earlier today into the 0.6 dev branch. You can test it out with composer require bunny/bunny:^0.6@dev. Looking forward to any feedback on it before releasing bunny/bunny 0.6 in a few months. With the following other changes:

  • @phpstan at max level
  • fully typed and type templated where needed
  • fully lazy client (automatic connects and disconnections)

djumaka, to php
@djumaka@phpc.social avatar

Guys I need some helping hand. I need some good reading (book/article) on the proper way of writing OOP. I gave a project where we use classes, but they are more used as a package if functions then working like objects. Like a class of only statics, passing around IDs not the real objects of data (this sending SRP down the drain), arrays, generally functional programming with extra steps. I'd fancy even a discussion as I want to slowly explain all that to my teammates
TIA

tylersticka, to wordpress
@tylersticka@social.lol avatar

I still have all of these issues with WordPress and portable patterns: https://cloudfour.com/thinks/wordpress-blocks-portable-patterns-and-pain-points/

But, it’s really heartening to see what the @enhance_dev project is doing to break down those barriers, as detailed here by @ryanbethel: https://begin.com/blog/posts/2024-05-03-portable-ssr-components

(I’ve updated my article to include a link.)

mobileatom, to Symfony
@mobileatom@me.dm avatar

Explore today's @SymfonyStation Communiqué of Symfony, Drupal, PHP, Fediverse, and Cybersecurity news. https://symfonystation.mobileatom.net/Symfony-Station-Communique-10-May-2024 🇺🇦

mobileatom, to Symfony
@mobileatom@flipboard.com avatar

Explore today's @SymfonyStation Communiqué of Symfony, Drupal, PHP, Fediverse, and Cybersecurity news. 🇺🇦

https://symfonystation.mobileatom.net/Symfony-Station-Communique-10-May-2024?utm_source=flipboard&utm_medium=activitypub

Posted into SYMFONY FOR THE DEVIL @symfony

symfonystation, to Symfony
@symfonystation@newsletter.mobileatom.net avatar
mobileatom, to Symfony
@mobileatom@me.dm avatar

Please join our newsletter list. As a reward, you will get our news communiqués one day early via The Payload! https://newsletter.mobileatom.net/ We cover -> and more.

symfonystation, to Symfony
@symfonystation@newsletter.mobileatom.net avatar

Please join our newsletter list. As a reward, you will get our news communiqués one day early via The Payload! https://newsletter.mobileatom.net/ We cover -> and more.

https://newsletter.mobileatom.net/join-our-newsletter-list/

Edent, to HowTo
@Edent@mastodon.social avatar

🆕 blog! “link rel="alternate" type="text/plain"”

Hot on the heels of yesterday's post, I've now made all of this blog available in text-only mode. Simply append .txt to the URl of any page and you'll get back the contents in plain UTF-8 text. No formatting, no images (although you can see the alt text), no nothing! Front page https://shkspr.mobi/blog/.txt This blog […]

👀 Read more: https://shkspr.mobi/blog/2024/05/link-relalternate-typetext-plain/

blog, to HowTo
@blog@shkspr.mobi avatar

link rel="alternate" type="text/plain"
https://shkspr.mobi/blog/2024/05/link-relalternate-typetext-plain/

Hot on the heels of yesterday's post, I've now made all of this blog available in text-only mode.

Simply append .txt to the URl of any page and you'll get back the contents in plain UTF-8 text. No formatting, no images (although you can see the alt text), no nothing!

This was slightly tricky to get right! While there might be an easier way to do it, here's how I got it to work.

Firstly, when someone requests /whatever.txt, WordPress is going to 404 - because that page doesn't exist. So, my theme's functions.php, detects any URls which end in .txt and redirects it to a different template.

//  Theme Switcheradd_filter( "template_include", "custom_theme_switch" );function custom_theme_switch( $template ) {    //  What was requested?    $requested_url = $_SERVER["REQUEST_URI"];    //  Check if the URL ends with .txt    if ( substr( $requested_url, -4 ) === ".txt")  {            //  Get the path to the custom template        $custom_template = get_template_directory() . "/templates/txt-template.php";        //  Check if the custom template exists        if ( file_exists( $custom_template ) ) {            return $custom_template;        }    }    //  Return the default template    return $template;}

The txt-template.php file is more complex. It takes the requested URl, strips off the .txt, matches it against the WordPress rewrite rules, and then constructs the WP_Query which would have been run if the .txt wasn't there.

//  Run the query for the URl requested$requested_url = $_SERVER['REQUEST_URI'];    // This will be /whatever$blog_details = wp_parse_url( home_url() );  // Get the blog's domain to construct a full URl$query = get_query_for_url(     $blog_details["scheme"] . "://" . $blog_details["host"] . substr( $requested_url, 0, -4 ));function get_query_for_url( $url ) {    //  Get all the rewrite rules    global $wp_rewrite;    //  Get the WordPress site URL path    $site_path = parse_url( get_site_url(), PHP_URL_PATH ) . "/";    //  Parse the requested URL    $url_parts = parse_url( $url );    //  Remove the domain and site path from the URL    //  For example, change `https://example.com/blog/2024/04/test` to just `2024/04/test`    $url_path = isset( $url_parts['path'] ) ? str_replace( $site_path, '', $url_parts['path'] ) : '';    //  Match the URL against WordPress rewrite rules    $rewrite_rules = $wp_rewrite->wp_rewrite_rules();    $matched_rule = false;    foreach ( $rewrite_rules as $pattern => $query ) {        if ( preg_match( "#^$pattern#", $url_path, $matches ) ) {            $matched_rule = $query;            break;        }    }    //  Replace each occurrence of $matches[N] with the corresponding value    foreach ( $matches as $key => $value ) {        $matched_rule = str_replace( "$matches[{$key}]", $value, $matched_rule );    }    //  Turn the query string into a WordPress query    $query_params = array();    parse_str(        parse_url( $matched_rule, PHP_URL_QUERY),         $query_params    );    //  Construct a new WP_Query object using the extracted query parameters    $query = new WP_Query($query_params);    //  Return the result of the query    return $query;}

From there, it's a case of iterating over the posts returned by the query. You can see the full code on my GitLab.

https://shkspr.mobi/blog/2024/05/link-relalternate-typetext-plain/

mobileatom, to php
@mobileatom@flipboard.com avatar
mobileatom, to php
@mobileatom@flipboard.com avatar
edgren, to php

The more I'm thinking about it, the more I consider it.

I want to add a map for my bicycle rides, but I can't find any good PHP maps. The PHP versions of Leaflet on GitHub are no good. They don't work at all. They just gives you errors like "can't load class" or something like that.

So even if I am against it only to challenge myself, I consider using Leaflet in JS for airikr.me/biking.

Or do you have any solution in PHP that works out of the box?

mobileatom, to php
@mobileatom@flipboard.com avatar
mobileatom, to php
@mobileatom@flipboard.com avatar
sarah, to php
@sarah@phpc.social avatar

I strongly prefer composition over inheritance.

If you can compose objects of other objects and use interfaces over concretions, you make it much easier to modify your app in future.

Ultimately the time you take to design your app will be spent now (in design) or later (in maintenance). Since most apps spend most of their life in maintenance, don’t make the mistake of saving time now and spending it later.

mobileatom, to Symfony
@mobileatom@me.dm avatar

Explore this week's edition of The Payload. It has the latest developments in the Symfony, Drupal, PHP, Cybersecurity, and Fediverse communities. https://newsletter.mobileatom.net/?mailpoet_router&endpoint=view_in_browser&action=view&data=WzI1LCIzMjhiMjNmZGE1NjQiLDEwMywiYWMwYjRlIiwyMSwxXQ

  • All
  • Subscribed
  • Moderated
  • Favorites
  • Leos
  • vwfavf
  • magazineikmin
  • thenastyranch
  • Youngstown
  • everett
  • rosin
  • slotface
  • ngwrru68w68
  • InstantRegret
  • PowerRangers
  • kavyap
  • tsrsr
  • DreamBathrooms
  • normalnudes
  • hgfsjryuu7
  • mdbf
  • cisconetworking
  • osvaldo12
  • khanakhh
  • Durango
  • GTA5RPClips
  • tacticalgear
  • ethstaker
  • tester
  • cubers
  • modclub
  • anitta
  • All magazines