Skip to content

Get User's home, Application data directory, etc.

Notifications You must be signed in to change notification settings

Arcesilas/Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Platform

Want to know where is User's home directory without needing to check if your script is running on a Unix-like or Windows OS? Want to know where you can store some configuration file or data? This package is for you!

Notice: This is a work in progress and help is welcome to make this tool reliable accross platforms.

Installation

composer require arcesilas/platform

Usage

Main available methods:

// Is the script running on a Windows OS
Platform::isWindows(); // returns a boolean

// Get user's home directory
Platform::getUserHome(); // example: /home/johndoe or C:\Users\johnd

// Get a directory to store data
Platform::getDataDir(); // example: /home/johndoe/.local/share or C:\Users\johnd\AppData\Local

// Get a directory to store configuration files
// On windows, defaults to user's home
Plateform::getConfigDir(); // example: /home/johndoe/.config

// Get a directory to store configuration
// On Windows, defaults to user's home
Plateform::getCacheDir(); // example: /home/johndoe/.cache

References

About

Get User's home, Application data directory, etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages