Download the PHP package tekintian/phpenv without Composer

On this page you can find all versions of the php package tekintian/phpenv. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package phpenv

PHP .ENV环境变量解析工具

php环境下 evn环境解析处理工具类库, 支持自定义env文件加载, 自动类型过滤和转换,自动加载等功能。

使用方法:

Composer 方式

  1. Composer安装类库

    # 加载env类库
    composer require  tekintian/phpenv
    
    # 本类库依赖 vlucas/phpdotenv 和 phpoption/phpoption 上面的命令执行后这2个依赖会自动加载
  2. 加载env环境配置文件和使用示例

    注意 当前的入口文件位于 public 下,

    # 在你的项目的入口中增加
    require_once dirname(__DIR__) . '/vendor/autoload.php';
    
    # 加载自定义env文件
    # Env::load(dirname(__DIR__), '.env');
    # 直接使用 env 函数获取,支持默认数据和数据过滤和类型转换
    $app_url = env("APP_URL");
    
    var_dump($app_url);
    
    # 获取int类型数据
    $app_port = env("APP_PORT",80,'int');
    
    # 获取 bool类型数据
    $debug = env("APP_DEBUG",false,'bool');
    
    # 其他还支持 int, float, bool, url ,ip, regexp, email, domain , string 数据过滤和验证,使用方法类似。
    
    • 1.0.x版本使用方法
    
    # 在你的项目的入口中增加
    require_once dirname(__DIR__) . '/vendor/autoload.php';
    # 定义项目根目录
    define('ROOT_PATH', dirname(__DIR__));
    
    use tekintian\phpenv\Env;
    # 如果你的.env文件不在项目根路径中,则需要手动执行Env::load加载
    # 加载环境变量配置文件 注意第一个参数为env环境配置文件的路径, 第二个参数为环境配置文件名mor  .env
    #Env::load(dirname(__DIR__), '.env');
    
    # 使用自定义助手函数获取配置
    // $app_url = env("APP_URL", "");
    
    # 直接使用Env对象获取
    $app_url = Env::get("APP_URL");
    
    var_dump($app_url);
  3. .env 环境配置文件参考示例
APP_NAME=Laravel
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost

env 函数封装

演示

├── composer.json
├── composer.lock
├── helper 帮助目录
│   └── helper.php
├── public 公共目录
│   └── index.php  入口文件
└── vendor 供应商目录
    ├── autoload.php
    ├── composer
    ├── graham-campbell
    ├── phpoption
    ├── symfony
    ├── tekintian
    └── vlucas
# 进入项目根目录执行 
php -S localhost:8080 -t public/

# 访问测试地址 看到输出 http://localhost 即表示成功
http://localhost:8080/index.php

#输出:
Env环境变量
APP_URL=http://localhost
APP_NAME=MyApp

env函数在配置文件中的使用示例:

<?php

return [
    'name' => env('APP_NAME', 'MyApp'),
    'env' => env('APP_ENV', 'production'),
    'debug' => (bool) env('APP_DEBUG', false),
    'url' => env('APP_URL', 'http://localhost'),
];

All versions of phpenv with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
phpoption/phpoption Version ^1.9
vlucas/phpdotenv Version ^5.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tekintian/phpenv contains the following files

Loading the files please wait ....