Skip to content Navigation Menu Toggle navigation Sign in Appearance settings PlatformAI CODE CREATIONGitHub CopilotWrite better code with AIGitHub Copilot appDirect agents from issue to mergeMCP RegistryNewIntegrate external toolsDEVELOPER WORKFLOWSActionsAutomate any workflowCodespacesInstant dev environmentsIssuesPlan and track workCode ReviewManage code changesAPPLICATION SECURITYGitHub Advanced SecurityFind and fix vulnerabilitiesCode securitySecure your code as you buildSecret protectionStop leaks before they startEXPLOREWhy GitHubDocumentationBlogChangelogMarketplaceView all featuresSolutionsBY COMPANY SIZEEnterprisesSmall and medium teamsStartupsNonprofitsBY USE CASEApp ModernizationDevSecOpsDevOpsCI/CDView all use casesBY INDUSTRYHealthcareFinancial servicesManufacturingGovernmentView all industriesView all solutionsResourcesEXPLORE BY TOPICAISoftware DevelopmentDevOpsSecurityView all topicsEXPLORE BY TYPECustomer storiesEvents & webinarsEbooks & reportsBusiness insightsGitHub SkillsSUPPORT & SERVICESDocumentationCustomer supportCommunity forumTrust centerPartnersView all resourcesOpen SourceCOMMUNITYGitHub SponsorsFund open source developersPROGRAMSSecurity LabMaintainer CommunityAcceleratorGitHub StarsArchive ProgramREPOSITORIESTopicsTrendingCollectionsEnterpriseENTERPRISE SOLUTIONSEnterprise platformAI-powered developer platformAVAILABLE ADD-ONSGitHub Advanced SecurityEnterprise-grade security featuresCopilot for BusinessEnterprise-grade AI featuresPremium SupportEnterprise-grade 24/7 supportPricing Search or jump to... Search code, repositories, users, issues, pull requests... Search Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. Include my email address so I can be contacted Saved searches Use saved searches to filter your results more quickly Name Query To see all available qualifiers, see our documentation. Sign in Sign up Appearance settings Resetting focus You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} phalapi / phalapi Public Notifications You must be signed in to change notification settings Fork 370 Star 1.6k Code Issues 29 Pull requests 2 Actions Projects Wiki Security and quality 0 Insights Additional navigation options Code Issues Pull requests Actions Projects Wiki Security and quality Insights 02 tutorial Jump to bottom Edit New page dogstar edited this page Mar 19, 2017 · 1 revision 2.1 Tutorial In this chapter, we wil explore how to enjoy developing an API in the shortest time. Here we go! 2.2 Write an API Let's start from "Hello World!". Put the follow code inside file ./Demo/Api/Welcome.php. <?php class Api_Welcome extends PhalApi_Api { public function say() { $rs = array(); $rs['title'] = 'Hello World!'; return $rs; } } 2.3 Visit the API The API service link looks like: http:// + host + entrance + ?service=XXX.XXX Yeah out demo link is: http://dev.phalapi.com/demo/?service=Welcome.Say 2.4 Get the result PhalApi will response with JSON, so here it is: {"ret":200,"data":{"title":"Hello World!"},"msg":""} To make the result more clear, { "ret": 200, "data": { "title": "Hello World!" }, "msg": "" } 2.5 Screenshoot 2.5 Congraduations! You have been smark at develop APIs with PhalApi! Enjoy it and more detail at PhalApi. Wiki pages Pages 15 Loading Home Uh oh! There was an error while loading. Please reload this page. Loading 01 create your project Uh oh! There was an error while loading. Please reload this page. Loading 02 tutorial 2.1 Tutorial 2.2 Write an API 2.3 Visit the API 2.4 Get the result 2.5 Screenshoot 2.5 Congraduations! Loading 03 use phaApi or not Uh oh! There was an error while loading. Please reload this page. Loading 04 API Request Uh oh! There was an error while loading. Please reload this page. Loading 05 Parameter Rule Uh oh! There was an error while loading. Please reload this page. Loading 06 API Response Uh oh! There was an error while loading. Please reload this page. Loading 07 Database Based NotORM Uh oh! There was an error while loading. Please reload this page. Loading 08 Config Uh oh! There was an error while loading. Please reload this page. Loading 09 Logger Uh oh! There was an error while loading. Please reload this page. Loading 10 Autoload Uh oh! There was an error while loading. Please reload this page. Loading 11 Cache Uh oh! There was an error while loading. Please reload this page. Loading 12 Gateway Uh oh! There was an error while loading. Please reload this page. Loading 13 i18n Uh oh! There was an error while loading. Please reload this page. Loading index Uh oh! There was an error while loading. Please reload this page. Add a custom sidebar Clone this wiki locally You can’t perform that action at this time.