PHP code example of infanatica / infanatica-cep-module

1. Go to this page and download the library: Download infanatica/infanatica-cep-module library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

infanatica / infanatica-cep-module example snippets


    
    return array(
        'modules' => array(
            // ...
            'InfanaticaCepModule',
        ),
        // ...
    );

	
	//...
	class IndexController extends AbstractActionController
	{
		public function indexAction()
	    {
			$cep = '21041020';

			// Possíveis formatos (json, xml, query, object, array)
			// null = \InfanaticaCepModule\Response\EnderecoResponse
			$formato        = 'json';

			$serviceLocator = $this->getServiceLocator();
			$cepService     = $serviceLocator->get('InfanaticaCepModule\Service\CepService');
			$endereco       = $cepService->getEnderecoByCep($cep,$formato);
			var_dump($endereco);

	        return new ViewModel();
	    }
    //...
bash
    $ php composer.phar update