php_serializer 0.1.1 copy "php_serializer: ^0.1.1" to clipboard
php_serializer: ^0.1.1 copied to clipboard

outdated

Serialize and deserialize Strings that the Php-Functions serialize created or unserialize can parse, so Dart code can communicate with Php in its native format

example/example.md

Transfer data from Php to Dart #

<?php
$trivialArray = [
    1, 1, 2, 3, 5, 8
];
echo serialize($trivialArray);
//Output: a:6:{i:0;i:1;i:1;i:1;i:2;i:2;i:3;i:3;i:4;i:5;i:5;i:8;}
void main() {
  String inputFromPhp = 'a:6:{i:0;i:1;i:1;i:1;i:2;i:2;i:3;i:3;i:4;i:5;i:5;i:8;}';
  assert([1, 1, 2, 3, 5, 8] == phpDeserialize(inputFromPhp));
}

Transfer data from Dart to Php #

void main() {
  List<int> trivialList = [1, 1, 2, 3, 5, 8];
  print(phpSerialize(trivialList));
  //Output: a:6:{i:0;i:1;i:1;i:1;i:2;i:2;i:3;i:3;i:4;i:5;i:5;i:8;}
}
<?php
$inputFromDart = 'a:6:{i:0;i:1;i:1;i:1;i:2;i:2;i:3;i:3;i:4;i:5;i:5;i:8;}';
\assert([1, 1, 2, 3, 5, 8] === unserialize($inputFromDart));
9
likes
0
pub points
85%
popularity

Publisher

verified publishermanu311.de

Serialize and deserialize Strings that the Php-Functions serialize created or unserialize can parse, so Dart code can communicate with Php in its native format

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on php_serializer