{"id":21569230,"url":"https://github.com/symlex/stream-sampler","last_synced_at":"2026-05-19T17:11:31.037Z","repository":{"id":57063786,"uuid":"44383817","full_name":"symlex/stream-sampler","owner":"symlex","description":"Example PHP Command-line Application based on Symlex Core","archived":false,"fork":false,"pushed_at":"2019-01-09T03:56:57.000Z","size":46,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-24T12:28:41.299Z","etag":null,"topics":["example-project","php","php-framework","stream-sampler","symfony","symfony-console"],"latest_commit_sha":null,"homepage":"https://docs.symlex.org","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/symlex.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-16T12:32:50.000Z","updated_at":"2020-01-09T14:30:40.000Z","dependencies_parsed_at":"2022-08-24T14:00:45.095Z","dependency_job_id":null,"html_url":"https://github.com/symlex/stream-sampler","commit_stats":null,"previous_names":[],"tags_count":7,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symlex%2Fstream-sampler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symlex%2Fstream-sampler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symlex%2Fstream-sampler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/symlex%2Fstream-sampler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/symlex","download_url":"https://codeload.github.com/symlex/stream-sampler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244166640,"owners_count":20409177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["example-project","php","php-framework","stream-sampler","symfony","symfony-console"],"created_at":"2024-11-24T11:07:33.560Z","updated_at":"2026-05-19T17:11:25.993Z","avatar_url":"https://github.com/symlex.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example CLI app based on [Symlex Core](https://github.com/symlex/symlex-core)\n\n[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![Build Status](https://travis-ci.org/symlex/stream-sampler.png?branch=master)](https://travis-ci.org/symlex/stream-sampler)\n[![Documentation](https://readthedocs.org/projects/symlex-docs/badge/?version=latest\u0026style=flat)](https://docs.symlex.org/en/latest/)\n[![Community Chat](https://badges.gitter.im/symlex/community.png)](https://gitter.im/symlex/community)\n\nThis application is compatible with PHP 7.1+ with the *curl* extension enabled.\n\nClone this repository to a local directory and run composer:\n\n    git clone https://github.com/symlex/stream-sampler.git\n    cd stream-sampler\n    composer update\n\nAlternatively you can run composer to create a new project from the latest stable release and fetch external dependencies:\n\n    composer create-project symlex/stream-sampler my-stream-sampler\n\nComposer will ask for config values to generate `app/config/parameters.yml` for you.\n\nYAML files located in `app/config` configure the app based on parameters and services.\nThe main config file is `app/config/console.yml`.\n\n## What does a stream sampler do?\n\nIt randomly returns a representative sample of *k* items from a stream of values with unknown and\npossibly very large length. The implementation relies on Algorithm R, which has a complexity of O(N).\nSee https://en.wikipedia.org/wiki/Reservoir_sampling\n\n## Usage\n\n    app/console sample [options]\n\n    Options:\n      -i, --input[=INPUT]   Input source (stdin, random.org, internal) [default: \"stdin\"]\n      -s, --size[=SIZE]     Sample size (1 - 2000) [default: 5]\n      -V, --version         Display the application version\n          --ansi            Force ANSI output\n          --no-ansi         Disable ANSI output\n\n*Note: If you're using random.org or the internal random character source, input data size will be 10 times the sample size. The maximum sample size is 2000.*\n\n## Examples\n\n    # app/console sample -i internal -s 10\n    vgB4xtQTF3\n\n    # app/console sample -i random.org -s 8\n    FcojkJX1\n\n    # app/console sample \u003c LICENSE\n    TegcI\n\n    # echo 'Pe7emsXm0EHfwAVx' | app/console sample\n    Xe7es\n\n## Tests\n\nStream Sampler comes with a pre-configured PHPUnit environment that automatically executes tests found in `src/`:\n\n    PHPUnit 7.5.1 by Sebastian Bergmann and contributors.\n    \n    .......                                         7 / 7 (100%)\n    \n    Time: 431 ms, Memory: 8.00MB\n    \n    OK (7 tests, 16892 assertions)\n\nSee also: https://github.com/lastzero/test-tools (self-initializing database fixtures and dependency injection for unit tests)\n\n## Similar work\n\n- https://github.com/htimur/stream-sampler (PHP)\n- https://github.com/Shaked/rg-stream-sampler (PHP)\n- https://github.com/dotMR/stream-sampler (JavaScript)\n- https://github.com/dousto/weighted-reservoir-sampler (JavaScript)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsymlex%2Fstream-sampler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsymlex%2Fstream-sampler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsymlex%2Fstream-sampler/lists"}