René's URL Explorer Experiment


Title: [RFC] Consider adding functional API · Issue #330 · reactphp/reactphp · GitHub

Open Graph Title: [RFC] Consider adding functional API · Issue #330 · reactphp/reactphp

X Title: [RFC] Consider adding functional API · Issue #330 · reactphp/reactphp

Description: Our OOP API has a pretty good, SOLID design – but let's face it, this often makes it hard to work with. For example, take a look at the following code required to connect to a remote host: $loop = React\EventLoop\Factory::create(); $reso...

Open Graph Description: Our OOP API has a pretty good, SOLID design – but let's face it, this often makes it hard to work with. For example, take a look at the following code required to connect to a remote host: $loop = ...

X Description: Our OOP API has a pretty good, SOLID design – but let's face it, this often makes it hard to work with. For example, take a look at the following code required to connect to a remote host: $loo...

Mail addresses
notifications@github.com

Opengraph URL: https://github.com/reactphp/reactphp/issues/330

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[RFC] Consider adding functional API","articleBody":"Our OOP API has a pretty good, SOLID design – but let's face it, this often makes it hard to work with. For example, take a look at the following code required to connect to a remote host:\n\n```\n$loop = React\\EventLoop\\Factory::create();\n$resolverFactory = new React\\Dns\\Resolver\\Factory();\n$resolver = $resolverFactory->create('8.8.8.8', $loop);\n$connector = new Connector($loop, $resolver);\n$secure = new SecureConnector($connector, $loop);\n\n$secure->create('www.google.com', 443);\n```\n\nOur current OOP API suffers from the fact that we do not require any global/shared state. This means we can not assume any defaults for common setups and requires passing quite a few instances. Instances that are effectively only constructed once.\n\nAfter discussing this with @cboden, I figured it's worth opening this ticket as a basis for further discussion / RFC:\n\nThis ticket suggests we add a much simpler API on top of the existing class hierarchy (and does _not_ suggest _replacing_ it!). So we're merely talking about some API sugar.\n\nNote however, this comes at the cost of _some_ global state.\n\nAt the lowest level, we need a global accessor for the current loop (this has originally been suggested by @igorw (https://github.com/reactphp/event-loop/pull/10)):\n\n```\n$loop = \\React\\EventLoop\\loop();\n```\n\nStream component (requires global loop):\n\n```\n\\React\\Stream\\fopen('demo.txt', 'r')->then(function (Stream $stream) {\n\n});\n```\n\nDNS component (requires global loop and DNS `Resolver`):\n\n```\n\\React\\Dns\\lookup('www.google.com')->then(function ($ip) {\n    echo $ip;\n});\n```\n\nSocketClient component (requires global loop and DNS `Resolver`):\n\n```\n\\React\\SocketClient\\connect('google.com:80')->then(function (Connection $connection) {\n\n});\n```\n\nSocket component (requires global loop):\n\n```\n\\React\\Socket\\listen('localhost:1234')->then(function (Socket $socket) {\n    $socket->on('connection', function () { });\n});\n```\n","author":{"url":"https://github.com/clue","@type":"Person","name":"clue"},"datePublished":"2015-06-07T15:59:08Z","url":"https://github.com/reactphp/reactphp/issues/330"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:92039ac9-2313-e774-d40a-2dbaa5434787
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA55A:215B38:CA925:114792:6B0062B3
html-safe-nonceaaad2a9bfa06727c8b8da804e7ce8422161dedc63064da88be2bf76d206d23e8
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTVBOjIxNUIzODpDQTkyNToxMTQ3OTI6NkIwMDYyQjMiLCJ2aXNpdG9yX2lkIjoiNzc4MDY3NDE1ODY0MzQwNTQ5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac2610e26425f9b8caea88b8e61a8d20d9204f5e992ef6e4b1cd468c54f580ca0d
hovercard-subject-tagissue:85913411
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/reactphp/reactphp/330/issue_layout
twitter:imagehttps://opengraph.githubassets.com/49a8053b90fc6e3c30c8043bc0e3a6fed7a2e45a3aa861591d00803928b01465/reactphp/reactphp/issues/330
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/49a8053b90fc6e3c30c8043bc0e3a6fed7a2e45a3aa861591d00803928b01465/reactphp/reactphp/issues/330
og:image:altOur OOP API has a pretty good, SOLID design – but let's face it, this often makes it hard to work with. For example, take a look at the following code required to connect to a remote host: $loop = ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameclue
hostnamegithub.com
expected-hostnamegithub.com
None25854482a1773a7c1ebb8be3d2bc1c6e61d82d78126be63b5044474a86d44d9e
turbo-cache-controlno-preview
go-importgithub.com/reactphp/reactphp git https://github.com/reactphp/reactphp.git
octolytics-dimension-user_id1696866
octolytics-dimension-user_loginreactphp
octolytics-dimension-repository_id4287921
octolytics-dimension-repository_nworeactphp/reactphp
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id4287921
octolytics-dimension-repository_network_root_nworeactphp/reactphp
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee4f5c239e31f1f680e6bbc419ff92d774da616ec
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/reactphp/reactphp/issues/330#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Freactphp%2Freactphp%2Fissues%2F330
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Freactphp%2Freactphp%2Fissues%2F330
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=reactphp%2Freactphp
Reloadhttps://github.com/reactphp/reactphp/issues/330
Reloadhttps://github.com/reactphp/reactphp/issues/330
Reloadhttps://github.com/reactphp/reactphp/issues/330
reactphphttps://github.com/reactphp
reactphphttps://github.com/reactphp/reactphp
Codehttps://github.com/reactphp/reactphp
Issueshttps://github.com/reactphp/reactphp/issues
Pull requests5 (5)https://github.com/reactphp/reactphp/pulls
Discussionshttps://github.com/reactphp/reactphp/discussions
Actionshttps://github.com/reactphp/reactphp/actions
Wikihttps://github.com/reactphp/reactphp/wiki
Security and qualityhttps://github.com/reactphp/reactphp/security
Insightshttps://github.com/reactphp/reactphp/insights
https://github.com/reactphp/reactphp
New issuehttps://github.com/login?return_to=https://github.com/reactphp/reactphp/issues/330
New issuehttps://github.com/login?return_to=https://github.com/reactphp/reactphp/issues/330
[RFC] Consider adding functional APIhttps://github.com/reactphp/reactphp/issues/330#top
BC breakhttps://github.com/reactphp/reactphp/issues?q=state%3Aopen%20label%3A%22BC%20break%22
architecturehttps://github.com/reactphp/reactphp/issues?q=state%3Aopen%20label%3A%22architecture%22
help wantedhttps://github.com/reactphp/reactphp/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com/clue
cluehttps://github.com/clue
on Jun 7, 2015https://github.com/reactphp/reactphp/issues/330#issue-85913411
@cbodenhttps://github.com/cboden
@igorwhttps://github.com/igorw
reactphp/event-loop#10https://github.com/reactphp/event-loop/pull/10
cluehttps://github.com/clue
on Jul 6, 2016https://github.com/reactphp/reactphp/issues/330#event-714101065
https://github.com/clue
cluehttps://github.com/clue
on Jul 6, 2016https://github.com/reactphp/reactphp/issues/330#issuecomment-230726794
https://github.com/WyriHaximus
WyriHaximushttps://github.com/WyriHaximus
on Jul 6, 2016https://github.com/reactphp/reactphp/issues/330#issuecomment-230727941
https://github.com/async-interop/event-loophttps://github.com/async-interop/event-loop
https://github.com/SamMousa
SamMousahttps://github.com/SamMousa
on Aug 19, 2016https://github.com/reactphp/reactphp/issues/330#issuecomment-240947396
https://github.com/clue
cluehttps://github.com/clue
on Aug 19, 2016https://github.com/reactphp/reactphp/issues/330#issuecomment-240979267
https://github.com/SamMousa
SamMousahttps://github.com/SamMousa
on Aug 19, 2016https://github.com/reactphp/reactphp/issues/330#issuecomment-241000534
https://github.com/reactphp/socket-client/blob/master/src/TcpConnector.phphttps://github.com/reactphp/socket-client/blob/master/src/TcpConnector.php
https://github.com/clue
cluehttps://github.com/clue
on Aug 19, 2016https://github.com/reactphp/reactphp/issues/330#issuecomment-241005252
https://github.com/SamMousa
SamMousahttps://github.com/SamMousa
on Aug 19, 2016https://github.com/reactphp/reactphp/issues/330#issuecomment-241007086
#330 (comment)https://github.com/reactphp/reactphp/issues/330#issuecomment-241005252
https://github.com/notifications/unsubscribe-auth/AAhYzVv1r9ZFfgyUqrSZVaO7rv40T1MSks5qhaFvgaJpZM4E60Ushttps://github.com/notifications/unsubscribe-auth/AAhYzVv1r9ZFfgyUqrSZVaO7rv40T1MSks5qhaFvgaJpZM4E60Us
https://github.com/WyriHaximus
WyriHaximushttps://github.com/WyriHaximus
on Feb 22, 2017https://github.com/reactphp/reactphp/issues/330#issuecomment-281637545
https://github.com/idimensionz
idimensionzhttps://github.com/idimensionz
on Sep 10, 2017https://github.com/reactphp/reactphp/issues/330#issuecomment-328354916
https://symfony.com/doc/current/components/dependency_injection.htmlhttps://symfony.com/doc/current/components/dependency_injection.html
cluehttps://github.com/clue
architecturehttps://github.com/reactphp/reactphp/issues?q=state%3Aopen%20label%3A%22architecture%22
BC breakhttps://github.com/reactphp/reactphp/issues?q=state%3Aopen%20label%3A%22BC%20break%22
help wantedhttps://github.com/reactphp/reactphp/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
on Oct 17, 2017https://github.com/reactphp/reactphp/issues/330#event-1297013976
https://github.com/clue
cluehttps://github.com/clue
on Oct 17, 2017https://github.com/reactphp/reactphp/issues/330#issuecomment-337251579
cluehttps://github.com/clue
completedhttps://github.com/reactphp/reactphp/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Oct 17, 2017https://github.com/reactphp/reactphp/issues/330#event-1297018844
Sign up for freehttps://github.com/signup?return_to=https://github.com/reactphp/reactphp/issues/330
Sign in to commenthttps://github.com/login?return_to=https://github.com/reactphp/reactphp/issues/330
BC breakhttps://github.com/reactphp/reactphp/issues?q=state%3Aopen%20label%3A%22BC%20break%22
architecturehttps://github.com/reactphp/reactphp/issues?q=state%3Aopen%20label%3A%22architecture%22
help wantedhttps://github.com/reactphp/reactphp/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.