@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 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

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

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

@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,
@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

@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, (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 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/

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 indeed did not think about interfaces on enum will see if that resolve my issue

nyamsprod,
@nyamsprod@phpc.social avatar

@Crell trying to avoid/improve this signature

nyamsprod,
@nyamsprod@phpc.social avatar

@Crell currently the best I could do is this

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 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,
@nyamsprod@phpc.social avatar

@kaystrobach it was already present now just making it a bit more obvious and easy to use I hope.
It feels like SQL but it's 100% PHP at its core

nyamsprod,
@nyamsprod@phpc.social avatar

@thomas_shone should be andWhere will fix the document thanks for the quick look👍

nyamsprod,
@nyamsprod@phpc.social avatar

@derflocki there are a couple reasons why I do not use SQLite. First the package needs no dependencies, two, the feature was already present in the package like 7 years ago I only updated the UX around it and last but not least I seldom encounter CSV that adheres fully to the draft/informal RDC. Hence using the SQLite extension would not solve CSV parsing in real world IMHO.

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 I'm going to try not sure about the result

nyamsprod,
@nyamsprod@phpc.social avatar

@derickr @Girgias I think I more or less was able to do base32_encode I'm still missing how I could rewrite this in C

$chars = (array) unpack('C*', $decoded);

Is there a way to call PHP implemetation of unpack directly 🤔 I presume there is but I have not found it or recognized it

nyamsprod,
@nyamsprod@phpc.social avatar

@derickr @Girgias
https://3v4l.org/iujGt

it converts the string characters into their byte representations and returns the result as an array

nyamsprod,
@nyamsprod@phpc.social avatar

@derickr @Girgias nice ... should then ease my conversion. will try to finish that one so you can see/review my horrible code. Once stable I will tackle the base32_decode which is more complex IMHO

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

@derickr @Girgias https://github.com/bakame-php/php-src/pull/1/commits/61ab6aa33c6276b7eb8baea87578e8bd843b3c8e Added base32_encode .. you can take your red pen 😅 I'm pretty sure there are stuff that needs correction

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

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