bocharsky-bw / arrayzy Goto Github PK
View Code? Open in Web Editor NEW:package: The wrapper for all PHP built-in array functions and easy, object-oriented array manipulation library. In short: Arrays on steroids.
License: MIT License
:package: The wrapper for all PHP built-in array functions and easy, object-oriented array manipulation library. In short: Arrays on steroids.
License: MIT License
Hi Victor, is it possible that you create a Version where the find method is included? This would be much appreciated.
Support get->('array.get.key')
?
Since this package minimum requirement is PHP 5.4 you should update your code to typehint against callable
instead of closure
as this would broaden its usability.
Add test coverage statistic icon to README.md
Вітаю!
Було б непогано реєструвати свої власні методи, типу такого API, щоб на льоту визначати функції і викликати потім через __call і __callStatic
A::register('myMethod', function(){
/* ... */
})
$ A = A :: create (['a', 'b', 'c']);
$ A -> myMethod();
Based on that fact there're many projects works legacy on PHP 5.3 we definitily should provide this support with Arrayzy. Thanks @danielstjules for pointing me.
Hi,
First of all, I'd like to say that I really like this project. One for its simplicity, and two for the fact that it has interfaces and traits. Thanks a lot, @bocharsky-bw!
However, having interfaces in the same repository as the implementation kind of beats the point of having interfaces, in my opinion. In my particular case, I would like to provide a padding interface that all my libraries and components can depend on, and use your implementation in the actual application. However, because you have the interfaces published together with the implementation, my libs have to depend on your implementation, whereas I would like to only depend on your interfaces.
Therefore, I would like to make a humble request that you publish the interfaces separately, and have this project depend on them. Then, I can do the same :)
Thanks again.
This is not quite what you expect having an array with just one value, compared to the build-in array methods.
This Hall_of_Famer idea from his comment on reddit.com.
I see that you create your array objects by accepting a parameter of PHP array. I wonder though, why dont you just make the constructor and other factory methods variadic? So instead of this:
$immArr = new ImmutableArray([1, 2, 3]);
$mutArr = new MutableArray([1, 2, 3]);
You now have:
$immArr = new ImmutableArray(1, 2, 3);
$mutArr = new MutableArray(1, 2, 3);
This way the API looks a lot cleaner to me. Also I think it is better to separate arrays from dictionaries/hash tables. So it would be better to have separate classes that handle numeric and associative array differently, than to have one array class that does both.
Hi,
I have a project that uses PHPUnit >= 5.4. I would like to use your library, because your require-dev PHPUnit constraint ~4.5
won't allow it. Therefore, I ask if it's possible that you could upgrade the required version of PHPUnit. I understand that you would like to be able to test the library with older versions of PHPUnit, and therefore I suggest that you specify the version for phpunit/phpunit
as ~4.5 || ^5.0
or similar. I ran composer update phpunit/phpunit --with-dependencies
while having the above constraint, and with PHPUnit then at 5.4 I ran phpunit
in the project directory without any issues, and all tests passing.
Thanks.
@bocharsky-bw Have you thought about having get
and set
methods? e.g.
$a = ImmutableArray::create(['key_1' => 'a', 'key_2' => 'b']);
$a->get('key_1'); // a
$a->set('key_2', 'c');
$a->get('key_2'); // c
Also as for multidimensional arrays, you could possible be able to chain get
e.g.
$a = ImmutableArray::create(['key_1' => ['key_2' => 'a']]);
$a->get('key_1')->get('key_2'); // a
The original ImmutableArray
object should NOT be changed with push()
, unshift()
, shift()
and pop
methods. It should return new object with this changes.
Thanks guys from reddit.com discussion.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.