Discover and read the best of Twitter Threads about #Php

Most recents (24)

#programming with a fellow #dev can be more productive than you can envision!
medium.com/p/528d555f7846
#Containers provide an unparallel lift for #AI and #MachineLearning
medium.com/p/37675980b4d
Read 12 tweets
I'm a web developer, and a lover of anagrams.

Here's how I create animated #anagrams for the @AnagramPost. (LONG THREAD 🧵)

#webdev #html #css #javascript #php #thread
In November 2022, I made a Python program to animate anagrams of tweets as an experiment.

It wasn't very easy to use or maintain, though. It's over 1,000 lines, ~160 of which are to work around Pygame being unable to wrap text or render emojis in color.
Sometime later, I decided to try refactoring it to make it less of a headache.

But partway through, I thought to myself, "Wait, why am I trying to recreate a web layout in Pygame? I should just...do it on the web!"

So I did.
Read 30 tweets
Have you ever heard of API versioning?

This is very handy when you need to add an alternative logic for some endpoints but want to keep the current logic for some users.

There are many ways to achieve this. I'm going to show a simple one in this 🧵

#Laravel #PHP #PHPC

1/4 Image
1. Create a folder api inside routes

2. Create a file v1.php inside routes/api

3. Create a file v2.php inside routes/api

4. Configure your routes/api.php file like the image

2/4 Image
5. Configure your routes/api/v1.php file like the image

3/4 Image
Read 4 tweets
In recent days I saw several examples of "actions" in #Laravel, but one especially got my attention and I wanted to clarify it - so we had little discussion with @wendell_adriel and I would like to share my opinion about this particular approach 🙂

🧵👇

Before we start, one important preface: I'm big fan of explicitness and testability, so I'm using dependency injection everywhere (where's applicable). Examples in this thread will use it too by default, along with #PHP 8.0+ syntaxes.
What caught my attention was instantiating action inside controller's method 🤔 That looked suspicious, because I'm used to different nomenclature.

My assumption after looking at the example was that `CreateUserAction` is more like a #CQRS command rather than action.
Read 22 tweets
📊🧵 #CoditoStats 🙂

While I don't care much about numbers, I check #TwitterAnalytics from time to time mostly because of monthly summaries. Let me tell you that last 28 days were pretty intense comparing to previous period 😁

Let's look what happened! 👇 Image
First of all @davorminchorov mentioned me in his thread about enums. We initially had discussion about them under his PR (github.com/learnhubdev/la…), but this thread extended it even more 🙂



(187 engagements at this point)
That motivated me to write thread about dictionaries, how I see them from theoretical and practical point of view 🙂 If you missed it, grab it here:

Image
Read 7 tweets
🤔 Dictionaries: should they be in the database? 🤔

Dictionary is set of values that are supported in your application. But how they should be defined? Well, as always, it depends 😉 #PHP #architecture

Let me tell you what I think about it 👇🧵
In general, I believe there are two types of dictionaries:

1) Internal, related to your app's logic
2) UI-managable, related to app instance's data

Let's look about difference between them 🙂
Internal dictionaries are represented in the code. With #PHP 8.1+ it's pretty straightforward - you can use enums 🙂 When you need to represent some state, string-backed enum is the best choice, because it's much better for debugging purposes. PHP 8.1 string-backed enum
Read 18 tweets
Praise should be done in public someone said to me once, so I am tweeting instead of emailing you @PovilasKorop
Been trying out a couple of premium courses on @DailyLaravel the last days and this site is lit 🔥

#Laravel #PHP

1/5
My latest discovery is the Laravel Learning Roadmap where you are given “mini exams” where you are tasked with coding something. Your work is automatically checked by GitHub actions upon submitting a PR.

laraveldaily.com/roadmap-learni…

2/5
One thing setting @DailyLaravel apart from other collections of courses is the way @PovilasKorop obv. studies actual usage in the wild and explains not only by theory but also with a practical, comparative look at code implementation of Laravel by different authors.
3/5
Read 5 tweets
1. Math and Statistics
Intro to Statistics - Udacity
🌐 bit.ly/3GMZe5n

Statistics - Udacity
🌐 bit.ly/3VKKzfB

Statistical Learning - Stanford University
🌐 bit.ly/3VqA5Sj
2. Excel
Introduction to MS Excel - Simplilearn
🌐 bit.ly/3u1h1OJ

Microsoft Excel: Online Tutorial for Beginners - Chandoo
🌐 bit.ly/3XzUHJO

Microsoft Excel Tutorial for Beginners - Free Code Camp
🌐 bit.ly/3Vax74G
Read 7 tweets
ROADMAP para ser BACKEND Developer

¿Queréis un roadmap con RECURSOS GRATUITOS para ser un gran desarrollador BACKEND?

Os dejo 7 recursos totalmente GRATIS para aprender las BASES que cualquier desarrollador BACKEND debe conocer

🧵👇

#backend #code #coding #programming #coding
1️⃣Aprende las BASES DE INTERNET

Antes de empezar a programar, entiende qué es Internet, qué es el protocolo HTTP y cómo funciona un navegador

Aquí tenéis un artículo muy interesante

vox.com/2014/6/16/1807…
2️⃣Frontend básico (HTML y CSS)

⚠️Opcional pero RECOMENDABLE⚠️

Aunque quieras ser desarrollador backend, es importante que conozcas las bases del frontend, es decir: #HTML y #CSS

Tienes el curso de @freeCodeCamp para aprender HTML, CSS y Responsive Web

freecodecamp.org/learn/2022/res…
Read 10 tweets
So for those who wanted to know about my initial experience with @phpstorm and using @github's codespaces. Lets just say it wasn't great. Here's my run-through of the first hour or so.

#php #codespaces #github
@phpstorm @github Installed Jetbrains Gateway, First miss-step was Github CLI was too old a version, the error message for this was not clear at all and vaguely mentioned a socket not being available.
@phpstorm @github A quick ‘brew upgrade gh’ later… okay, I seem to not be able to get Gateway working with an IDE environment running the work on Codespaces.
Read 14 tweets
As a PHP developer, there are a great number of static tools that you can use. Here are four off the top of my head that I regularly go to:

#php #laravel 🧵
@phpstan, this tool is great for finding little oddities in your code you might not even notice yourself. Things like unused variables or impossible scenarios. Larastan extends it for Laravel apps to handle some of the magic involved. github.com/nunomaduro/lar…
@phpstan Laravel Pint is the next one, it's PHP CS Fixer under the hood but a little bit nicer in just it's easy to install and set up with no additional dependencies. laravel.com/docs/9.x/pint
Read 6 tweets
We published new wrappers for our website and product categorization platforms.
#Python #website categorization wrapper, with #classifier using IAB taxonomy: pypi.org/project/websit…
Read 6 tweets
I will take this out and write a thread on why I don't enjoy writing #PHP anymore.

PHP development nowadays is bumping versions, updating types, and tests. And getting out of cross-dependencies conflicts.

👇
Let's take this situation, I have my own library MyLib that is expected to support PHP 7.4 and 8+ in the same time.

Meanwhile the coollib package I depend on releases its v2 where it changes interface of the same function to incompatible one: Image
Client #2 already migrated PHP 8.1 and wants to install coollib 2.0 while

Client #1 is using PHP 7.4 and can't move to coollib 2.0

As MyLib author I can either drop Client #1 and make a major release not because I introduced some breaking changes but because I bumped dep Image
Read 13 tweets
1/ A software engineer is a solution provider not only someone who writes code or helps to get code written.
#softwareEngineering #webDevelopment #code #softwareEngineer #solution #value #business 101 software engineering realities you must be aware of (esp
2/ Code is one of the ways to reach a solution, not the only way.
All the points at: geshan.com.np/blog/2022/09/s…
#code #noCode
3/ Solutions have value, mainly in terms of money earned or money saved. So the software you write is a path to saving money or earning more money for the business.
#businesValue #value #soluiton #softwareEngineering #webDevelopment
Read 101 tweets
There were many discussions if #Laravel's facades implement GoF's Facade Pattern, but I think it does not matter at this point - the team won't change naming convention anyway. Naming is not a problem, I see other issues with facades - a #PHP thread 🧵
1) They're basically magic 🪄 Some may see it as advantage, but I consider it as drawback. You don't execute exact code you're calling, but your call is proxied to some underlying service. It strictly couples your code with the framework, which handles it.
Facades' API has to be added as comments in PHPDoc (with `@Method`) which is error prone because it's easy to forget to update facade's phpdoc when underlying service (accessor) is changed. But even if autocompletion in IDE works, you just can't simply navigate to method's code.
Read 18 tweets
#VSCode extensions for #PHP / #Laravel developer

1. Auto Rename Tag
2. PHP Intelephense
3. PHP Namespace Resolver
4. PHP Debug
5. PHP CS Fixer for Visual Studio Code (code formatter)
6. PHP Create Class
7. PHP Constructor
8. Path Intellisense

🧵Thread
9. PHP Namespace Resolver
10. Laravel 5 Snippets
11. Laravel Blade Snippets
12. Laravel Blade Spacer
13. Laravel Extra Intellisense
14. Laravel goto view
15. Laravel Snippets
16. Prettier - Code formatter (JS, HTML, GraphQL · Markdown · YAML formatter)
17. JavaScript (ES6) code snippets
18. IntelliSense for CSS class names in HTML
Read 4 tweets
ROADMAP para ser BACKEND Developer

¿Queréis un roadmap con RECURSOS GRATUITOS para ser un gran desarrollador BACKEND?

Os dejo 6 recursos totalmente GRATIS para aprender las BASES que cualquier desarrollador BACKEND debe conocer

🧵👇

#backend #code #coding #programming #coding
1⃣ Aprende las BASES DE INTERNET

Antes de empezar a programar, entiende qué es Internet, qué es el protocolo HTTP y cómo funciona un navegador

Aquí tenéis un artículo muy interesante vox.com/2014/6/16/1807…
2⃣ Frontend básico (HTML y CSS)

Aunque quieras ser desarrollador backend, es importante que conozcas las bases del frontend, es decir: #HTML y #CSS

Tienes el curso de @freeCodeCamp para aprender HTML, CSS y Responsive Web: freecodecamp.org/learn/2022/res…
Read 9 tweets
0⃣Clean Code Series: Functions 📒💻

A guide to producing readable, reusable, and refactorable software in #php (#laravel #symfony #magento) #javascript #python, etc.

(References)
- Robert C. Martin's book "Clean Code"
- github .com/jupeter/clean-code-php

Mega Thread (14) 🧵👇 Image
1⃣ Clean Code Series: Functions📒🧑‍💻

☑️ Use default arguments instead of short-circuiting or conditionals Image
2⃣ Clean Code Series: Functions📒🧑‍💻

☑️ Function arguments (2 or fewer ideally)

🔹Zero arguments are the ideal case. One or two arguments are ok, and three should be avoided. Anything more than that should be consolidated. Image
Read 16 tweets
Hace 20 años cuando empece a programar me inventaba mis propios proyectos para practicar y mejorar.

✨ Tú no tienes que hacer eso ✨

Te dejo 10 #sitiosweb para practicar y mejorar tus skills como programador.

❤️ ¿Me ayudas con un RT?
Empecemos con el más conocido, HackerRank.

No solo tiene ejercicios de algoritmos, sino también una sección para prepararte para una entrevista.

Además, tener un buen puntaje en HR te puede sumar puntos cuando estés buscando empleo.

hackerrank.com
Code Wars tiene "kata" que son pequeños ejercicios de código para afianzar tus conocimientos.

Soporta desde #JavaScript hasta #Ruby o #Go o #PHP, lo que quieras.

Los ejercicios comienzan fácil, pero se van poniendo más complicados.

codewars.com
Read 12 tweets
💡 Let's do some date/time arithmetic with Carbon #PHP. It can't get any easier!

There are many ways to perform the same operation and the API is in plain English.

🧵 1/3
💡 In Carbon you'll always find handy unit shorthands or shortcuts. Also, timezones are welcome.

2/3
💡 With #PHP 7.1+, Carbon offers full tiny unit support down to microseconds.

3/3
Read 3 tweets
How to read code written by other people

Examples of tools

(also good for code you wrote yourself more than a week ago)

🧵🧵🧵(0/9)
(1/9) Code beautifiers

Sometimes, simply putting the right indents, line breaks, and highlighting variables can go a long way toward making your code more readable.

#javascript beautifier.io
#php beautifytools.com/php-beautifier…
#python tutorialspoint.com/online_python_…
(2/9) Deobfuscators

Sometimes developers purposely make code unreadable with special tools - obfuscators (especially often in websites)

In such cases it is possible to use deobfuscators.

#javascript lelinhtinh.github.io/de4js/
#java javadeobfuscator.com
Read 14 tweets
Hace 20 años cuando empece a programar me inventaba mis propios proyectos para practicar y mejorar.

✨ Tú no tienes que hacer eso ✨

Te dejo 10 #sitiosweb para practicar y mejorar tus skills como programador.

❤️ ¿Me ayudas con un RT?
Empecemos con el más conocido, HackerRank.

No solo tiene ejercicios de algoritmos, sino también una sección para prepararte para una entrevista.

Además, tener un buen puntaje en HR te puede sumar puntos cuando estés buscando empleo.

hackerrank.com
Code Wars tiene "kata" que son pequeños ejercicios de código para afianzar tus conocimientos.

Soporta desde #JavaScript hasta #Ruby o #Go o #PHP, lo que quieras.

Los ejercicios comienzan fácil, pero se van poniendo más complicados.

codewars.com
Read 12 tweets
TIL: Using `error_get_last()` in library code is almost always wrong 💥 #php #gotcha

See why this may or may not return a `Warning: Trying to access array offset on value of type null`? Image
We only call `error_get_last()` if we're sure an error occurred. However, while the error suppression operator `@` correctly hides errors, it still calls global error handlers set via `set_error_handler()` outside our control. In result, `error_get_last()` would return null! 💥
To be safe, correct error handling for functions that may report PHP warnings requires special care: Library code needs to account for any global error handlers by setting up a temporary error handler itself using `set_error_handler()` and `restore_error_handler()` ✅ #php Image
Read 4 tweets
@MeikTranel My first try got a without SQL statement and connection information (the #Delphi @interbase based stuff that @johnkaster built has been replaced by @embarcadero for #PHP and @mysql).

The second try gave me something similar to what you showed: archive.ph/TIWRy
@MeikTranel @InterBase @JohnKaster @embarcadero @MySQL Guessing from `BaseWiki31` I guessed they might still be on MediaWiki 1.31 which was an LTS version, but is unsupported now and has been replaced by 1.35 LTS.

Page source of docwiki.embarcadero.com confirms:

<meta name="generator" content="MediaWiki 1.31.1">

That's old!
@MeikTranel @InterBase @JohnKaster @embarcadero @MySQL It's also contrary to their own "upgrade, upgrade, upgrade" adagium.

MediaWiki versions are at:

- mediawiki.org/wiki/MediaWiki…
- mediawiki.org/wiki/MediaWiki…
- mediawiki.org/wiki/Version_l…
Read 5 tweets

Related hashtags

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!