PHP code example of itsmelepassos / phpoo-timezone
1. Go to this page and download the library: Download itsmelepassos/phpoo-timezone 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/ */
itsmelepassos / phpoo-timezone example snippets
/**
* Calls the composer autoload. Then, calls the respective class for the timezone.
* Chama o autoload do composer. Então, chame a classe respectiva para o fuso-horário.
*/
one com um dos fusos-horários suportados (https://www.php.net/manual/en/timezones.php).
*
* It can also be used in a central controller in your project.
* Pode também ser usado em um controlador central no seu projeto.
*/
(new Timezone())->timezone('America/Sao_Paulo');
/**
* Displays the time corresponding to the timezone configured above.
* Exibe a hora correspondente ao fuso-horário configurado acima
*/
echo date('d/m/Y H:i:s');
use ItsMeLePassos\Timezone\Timezone;
class Controller
{
/** @var Timezone */
protected $timezone;
/**
* Controller constructor.
*/
public function __construct()
{
$this->timezone = (new Timezone())->timezone('America/Sao_Paulo');
}
}
/**
* EN: No need to call anything else: the inherited class's constructor already assigns the custom timezone.
* PT-BR: Não precisa chamar mais nada: o construtor da classe herdada já atribui o fuso horário personalizado.
*/
class FooController extends Controller
{
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.