I try to make php connect to Outlook by follow this https://docs.microsoft.com/en-us/outlook/rest/php-tutorial but for environment i don't know where to put it or create new file. Please help and explain to me?
OAUTH_APP_ID=YOUR_APP_ID_HERE
OAUTH_APP_PASSWORD=YOUR_APP_PASSWORD_HERE
OAUTH_REDIRECT_URI=http://localhost:8000/authorize
OAUTH_SCOPES='openid profile offline_access User.Read Mail.Read'
OAUTH_AUTHORITY=https://login.microsoftonline.com/common
OAUTH_AUTHORIZE_ENDPOINT=/oauth2/v2.0/authorize
OAUTH_TOKEN_ENDPOINT=/oauth2/v2.0/token
This is a showcase how you can implement Laravel like .env file structure in your CodeIgniter application, and make configurations easy for all the development, production, testing stages. You don't need to take care of application/config/database.php
file each time you do git pull
or put it in .gitignore
.
vlucas/phpdotenv
via composer Run
composer require vlucas/phpdotenv
command in your project root directory. (If you don't have composer.json, don't worry, composer will take care of it.
Env.php
to your application/libraries
directory.This will load your env file in environment.
general_helper.php
to your application/helpers
directory.This will add
env
helper method to get any variable stored in.env
file.
Add library to
$autoload['libraries']
like this
$autoload['libraries'] = array('env');
Add helper to
$autoload['helper']
like this
$autoload['helper'] = array('general');
Create an .env
file
Create an .env
file in your project root folder.
Access an env variable
In your php code you can access any .env variable like below
env('MY_VARIABLE');
Source: https://github.com/technoknol/env-in-CodeIgniter
I suggest you create a new file named .env, and put it on you web root.
Then, install package vlucas/phpdotenv
use composer .
This package can Loads environment variables from .env to getenv(), $_ENV and $_SERVER automagically.
The Laravel framework distinguish environment by it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With