@nyamsprod@phpc.social
@nyamsprod@phpc.social avatar

nyamsprod

@nyamsprod@phpc.social

Software developer. Creator of PHP centric package like league/csv and league/uri. Sponsor me at github.com/sponsors/nyamsprod

This profile is from a federated server and may be incomplete. Browse more on the original instance.

nyamsprod, to random French
@nyamsprod@phpc.social avatar

@derickr @Girgias I have updated my Draft RFC for base32_encode/base32_decode. Let me know what you think about the new proposal.
https://gist.github.com/nyamsprod/8a5cf21c136952a46ec8836f29738c82

nyamsprod,
@nyamsprod@phpc.social avatar

@derickr @Girgias yes I saw it been a bit busy with work related tasks. Will continue on the implementation next week if all settles down a bit

nyamsprod, to php French
@nyamsprod@phpc.social avatar

I wish #PHP had two things and none of them involve generics... I wish it had type aliases and a native base32 encoding/decoding mechanism (in a class or a pair of functions I do not care)

nyamsprod, to php
@nyamsprod@phpc.social avatar

I have a question regarding dependencies and semver for maintainers. let's say I have package B which depends on package A.

If I move a class from package A to package B does this constitute a BC break for A and B or only for A ?

nyamsprod,
@nyamsprod@phpc.social avatar

@alessandrolai I have an easy way out I can bump package A to the next major and keep B in it's current version and move the class there effectively embracing the BC break BUT it makes my monorepo ugly to work with until I bump package B to the same version as package A and I need in the meantime fin a good git-split tool able to handle 2 majors release ... that's the complex part

nyamsprod,
@nyamsprod@phpc.social avatar

@kboyd @cam if you do that then you make package A dependent of package B which is not what you want ... the end goal is to reduce package B dependencies to package A not to enforce tight coupling

nyamsprod,
@nyamsprod@phpc.social avatar

@cam thought about it but these are Interfaces otherwise I would have copy/paste and add a suffix and be done with it 😜

nyamsprod,
@nyamsprod@phpc.social avatar

@cam I think 99% of the people using package B are not even aware package A exists 😅

nyamsprod,
@nyamsprod@phpc.social avatar

@wouterj true it was a mistake of mine when I changed the architecture from horizontal to vertical dependencies I should have also move the interfaces at that moment 🤷

nyamsprod, to php French
@nyamsprod@phpc.social avatar

for the next version of League/uri-components I'm trying to come up with better UX for instance I re-implemented the pipeline patter on the UriModifier class as follow. What do you think ? The code is not yet set in stone so it can still evolve

nyamsprod, to random
@nyamsprod@phpc.social avatar

@Crell I have a question ? https://github.com/thephpleague/csv/blob/master/src/Operator/Comparison.php I use an Enum in the case because to me the number of Comparison operator is finit BUT there is a case for using a class instead for better type hinting ? What do you think from a DX perspective ?

nyamsprod,
@nyamsprod@phpc.social avatar

@Crell I already avoid callable as this type is a new addition in my list of thing not to type with ... the current signature is fine by me but might not be for end users unless they know what they are doing which is not guarantee but it is the least evil. I'm not sure if adding an interface will do TBH. I may settle with the current signature. Good sleep and being away of the code for a while might convince that this is the best solution at the moment in PHP land

nyamsprod,
@nyamsprod@phpc.social avatar

@Crell currently the best I could do is this

nyamsprod,
@nyamsprod@phpc.social avatar

@Crell opt to remove any method on the enum and used good old classes. The implementation feels a bit more natural IMHO and is usable outside League\CSV enum are still present but the usage is a bit "hidden"
Everything is defined under League\Csv\Constraint

nyamsprod, to php
@nyamsprod@phpc.social avatar

Coming soon in the next minor release of League\Csv 😍
still ironing the feature that you can already test on the master branch. give it a try
https://csv.thephpleague.com/9.0/reader/statement/#where-clauses

nyamsprod, to php French
@nyamsprod@phpc.social avatar

When getting an Iterator as returned by a function/method do you expect the Iterator to already be rewinded or not ? Asking because in this assumption is never guaranteed by any contract 🤔

nyamsprod, to random French
@nyamsprod@phpc.social avatar

Last night I published league/csv version 9.15.0 https://github.com/thephpleague/csv/releases/tag/9.15.0 I hope it will be the first and last release this year (aside any security and bug releases).. I think it will take time for people to adapt to all the new shiny things that landed in the package the past year.

nyamsprod, (edited ) to php French
@nyamsprod@phpc.social avatar

class A implements IteratorAggregate {
protected string $foo = 'bar';
public function getIterator(): Traversable {
yield from ['bar' => 'baz'];
}
public function q(): string {
return http_build_query($this);
}
}
echo (new A())->q();

what will be display ?

nyamsprod, (edited ) to php
@nyamsprod@phpc.social avatar

I know that ship has already sailed but it would have been nice if the spread operator on iterable did follow the semantic of iterator_to_array with the preserve keys argument being true

For context: https://3v4l.org/AKEbB

nyamsprod,
@nyamsprod@phpc.social avatar

@zimzat I get the reasoning behind but would have been "cool" nice to have the iterator_to_array behaviour when working with iterator it seems more appropriate

nyamsprod, to webdev French
@nyamsprod@phpc.social avatar

my last blog post on how I was able to parse and manipulate in https://nyamsprod.com/blog/extracting-data-from-html-table-in-php/

nyamsprod, to php French
@nyamsprod@phpc.social avatar

To Celebrate the 10th anniversary there a new minor release league/csv 9.12.0 with lots of exciting new features is out https://github.com/thephpleague/csv/releases/tag/9.12.0 #csv #php #oss

the main feature being able to convert you CSV records into DTOs

nyamsprod, (edited ) to php French
@nyamsprod@phpc.social avatar

what will be display ?

<?php

echo http_build_query(["x" => +1E+14]);

nyamsprod, (edited ) to javascript French
@nyamsprod@phpc.social avatar

In the upcoming League\Uri the new BaseUri class will yield more accurate result similar to URL for better interoperability

nyamsprod, to random
@nyamsprod@phpc.social avatar

league/csv 9.16.0 relesed with an improved query builder for CSV https://github.com/thephpleague/csv/releases/tag/9.16.0

I also added a smal blog post about the status of the library where it comes from and where it is right now

https://nyamsprod.com/blog/modernizing-leaguecsv-api/

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • thenastyranch
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • ngwrru68w68
  • provamag3
  • magazineikmin
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • JUstTest
  • All magazines