Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Leonid Mamchenkov:
PHP: Countries and currencies
Dec 04, 2018 @ 16:33:41

In a recent post to his site Leonid Mamchenkov has shared a few links to packages that provide country and currency lists and a new one he's discovered that does an even better job.

Many software projects deal with the lists of countries and currencies. Some of the most common tasks include country an currency dropdowns, country flags next to the IP, or pre-filling country codes in phone numbers.

All of that information is of course standardized and you often just need a library or two to provide and use it. And there are many of those. [...] Today, however, I came across a better option – antonioribeiro/countries, which is a collection of country and currency information for Laravel PHP framework. Laravel is not required though.

The package, easily installable via Composer, provides information for over 250 countries and 250 different currencies. There's also flags, maps, states, cities and more. Check out the repository for the full list of data it offers.

tagged: package currency country listing options

Link: http://mamchenkov.net/wordpress/2018/11/30/php-countries-and-currencies/

SitePoint PHP Blog:
Localizing Dates, Currency, and Numbers with Php-Intl
May 23, 2016 @ 17:52:32

On the SitePoint PHP blog Younes Rafie has continued his series about the PHP "Intl" extension for use in internationalizing an application. in this second part of the series he moves away from just strings and looks at using it for currencies and numbers.

The first part of this series was an introduction of the PHP Intl extension and of how to localize your application’s messages. In this part, we’re going to learn about localizing numbers, dates, calendars, and similar complex data.

The post is broken down into a few different sections, each with their own examples:

  • Localizing Decimals
  • Localizing Currencies
  • Timezones
  • Calendars

The "Intl" extension makes these operations relatively simple with plenty of built-in objects and methods to help with the translations between the formats. You can find out more about this extension in the PHP manual.

tagged: date currency localization number tutorial intl extension series part2

Link: https://www.sitepoint.com/localizing-dates-currency-and-numbers-with-php-intl/

SitePoint PHP Blog:
Voice controlled PHP apps with API.ai
Aug 31, 2015 @ 14:36:14

The SitePoint PHP blog has posted a tutorial showing you how to help your applications understand natural language with the help of the Api.ai service.

In this tutorial we’ll be looking into Api.ai, an API that lets us build apps which understand natural language, much like Siri. It can accept either text or speech as input, which it then parses and returns a JSON string that can be interpreted by the code that we write.

They start by explaining some of the concepts you'll need to know in using the service: agents, entities, intents, contexts, aliases and domains (each with a summary and examples). In their example, they show how to get the current time from any given places using their API. He shows you how to set up a free account and create a new agent. He then uses Guzzle (the HTTP client library) to make the request to the API with your API and subscription keys. They show the result of a query for "What's the current time in Barcelona Spain?" and how to extract the "location" value from the results. With this they then search the Google API for the local time of "Barcelona Spain". With the time in hand, they then use the responsive-voice.js library to convert the text to speech at the click of a button.

With all these concepts under your belt, they also walk you through a second application, a currency converter. It uses the same workflow as the previous example with the exception of using the CurrencyLayer.com API to perform the financial conversion. All code needed for this example is included as well. If you'd like to just jump to the end, they've also shared the complete code for both examples over on Github.

tagged: voice control api apiai tutorial localtime currency convert

Link: http://www.sitepoint.com/voice-controlled-php-apps-with-api-ai/

Three Devs & A Maybe Podcast:
I Want You Back
Nov 10, 2014 @ 15:19:34

The Three Devs and a Maybe podcast is back with their latest episode hosted by Michael Budd, Fraser Hart, Lewis Cains and Edd Mann. In episode #48, "I Want You Back", they talk about a wide range of topics including currency, git and passwords.

Two weeks in the making, we are finally back with another podcast installment. This week we touch upon the Unix philosophy, client drama, and shiny new MacBook Pros. We then move on to discuss the security concerns that have arisen from the introduction of contactless payment systems. Leading on from this we talk about the YubiKey and how it can be used to provide two-factor authentication, for services such as LastPass. Finally, we close with how 'tombstoning' your code trumps the dreaded commenting out every time.

You can listen to this latest episode either through the in-page player or by downloading the mp3 directly. If you enjoy the show, be sure to subscribe to their feed to get the latest episodes as their released!

tagged: threedevsandamaybe podcast ep48 security yubikey git currency

Link: http://threedevsandamaybe.com/i-want-you-back/

PHPSnippets.info:
Convert currencies using PHP, Google and cURL
Jul 19, 2010 @ 13:16:30

From the PHPSnippets.info site there's a recent post about using a conversion tool from Google to convert currency values from one type to another.

Just a few people know that Google have a built-in currencies calculator. (Just type 100$ in euros in Google search box if you want to test it) This calculator works very well, so what about using PHP and cURL and get this functionnality in your own web app?

The script makes a cURL request over to the Google API's calculator feature and passes in the amount to convert and the codes for the "to" and "from" (like USA, CAD or EUR). You'll need cURL support in your PHP installation to use the script, but it wouldn't be all that difficult to modify it to use a basic socket connection too.

tagged: convert currency google curl tutorial snippet

Link:

DevX.com:
Base Concepts of Internationalization in PHP
Aug 13, 2008 @ 14:37:12

The DevX website has recently posted this tutorial - a look at simple internationalization for your website.

If you develop Web applications that have an international target audience, then you have to take internationalization into account—a process that includes avoiding date/time or currency confusions and delivering all text pertinent to the user interface in the user's preferred language. Applications that can grow international traffic and improve revenue must respect their clients' needs.

They use the I18N PEAR package to handle most of the hard work and include the howto on grabbing the package, the structure and how to use it to get a country name from a code, work with the translation of numbers, currency and changing up date/time strings.

tagged: i18n internationalization tutorial concept currency datetime countrycode

Link:

Pádraic Brady's Blog:
Zend_Service_Currency Proposal
Sep 22, 2006 @ 18:27:39

Pádraic Brady, looking ahead to the work he will be doing over the next few months, is proposing on his blog about a new Zend Framework component - Zend_Service_Currency.

I did a quick check on what PHP classes are available for the purpose. There's really not a whole lot out there. There's a PEAR class along the lines I need, but it's released under the PHP License and, not to be too argumentative, I prefer non-PEAR solutions where the end-user may have no access to update PEAR.

So since the project is planned to use the Zend Framework, I shot off a mail to the Framework's fw-general mailing list to see if it would be a worthwhile contribution.

He sees that someone else had already opened a proposal for the same idea and decided to join with that group to work up the module. He also links to his original proposal and gives a brief overview of the goals of the package.

tagged: zend framework component proposal currency service zend framework component proposal currency service

Link:

Pádraic Brady's Blog:
Zend_Service_Currency Proposal
Sep 22, 2006 @ 18:27:39

Pádraic Brady, looking ahead to the work he will be doing over the next few months, is proposing on his blog about a new Zend Framework component - Zend_Service_Currency.

I did a quick check on what PHP classes are available for the purpose. There's really not a whole lot out there. There's a PEAR class along the lines I need, but it's released under the PHP License and, not to be too argumentative, I prefer non-PEAR solutions where the end-user may have no access to update PEAR.

So since the project is planned to use the Zend Framework, I shot off a mail to the Framework's fw-general mailing list to see if it would be a worthwhile contribution.

He sees that someone else had already opened a proposal for the same idea and decided to join with that group to work up the module. He also links to his original proposal and gives a brief overview of the goals of the package.

tagged: zend framework component proposal currency service zend framework component proposal currency service

Link:


Trending Topics: