Table of Contents
- ๐ฆ Class axelhahn\htgroup
 - ๐ถ Properties
 - 
๐ท Methods
- ๐น public __construct()
 - ๐น public add()
 - ๐น public debug()
 - ๐น public error()
 - ๐น public exists()
 - ๐น public generateContent()
 - ๐น public getFile()
 - ๐น public list()
 - ๐น public members()
 - ๐น public remove()
 - ๐น public rename()
 - ๐น public setFile()
 - ๐น public userAdd()
 - ๐น public userRemove()
 
 
๐ฆ Class axelhahn\htgroup
 ======================================================================
 PHP class to handle htgroup file
 This class can can handle .htgoups files:
 - add groups
 - rename
 - delete groups
 - list all groups or members
 ... and memberships
 - userAdd
 - userRemove
 @author www.axel-hahn.de
 @license GNU Public License 3.0
 @source https://github.com/axelhahn/php-htpasswd/
 ----------------------------------------------------------------------
 2025-07-19  initial version
 2025-07-21  v1.0  add flag nn list()
 2025-07-23  v1.1  update phpdoc
 2025-07-24  v1.2  add method getFile()
 2025-07-25  v1.3  fix readFile(); sort groups before saving
 2025-08-08  v1.4  add a comment in 1st line; ignore lines starting with # or ;
 2025-08-08  v1.5  add error() method to get the last error
 2025-08-12  v1.6  extend ht-base class
 ======================================================================
๐ถ Properties
(none)
๐ท Methods
๐น public __construct()
Constructor
Line 64 (6 lines)
Return: void
Parameters: 1 (required: 0)
| Parameter | Type | Description | 
|---|---|---|
| <optional> $sHtGroupFile | string | 
optional: full path of htgroup file | 
๐น public add()
Add a new group in htgroup file. It returns true if successful. It returns false
- if group already exists
 - writing .htgroup file failed
 
Line 189 (12 lines)
Return: bool
Parameters: 1 (required: 1)
| Parameter | Type | Description | 
|---|---|---|
| <required> $sGroup | string | 
group name to add | 
๐น public debug()
Enable or disable debug mode
Line 80 (4 lines)
Return: void
Parameters: 1 (required: 1)
| Parameter | Type | Description | 
|---|---|---|
| <required> $bDebug | bool | 
new value of debug flag | 
๐น public error()
Get the last error
Line 90 (4 lines)
Return: string
Parameters: 0 (required: 0)
๐น public exists()
Check if a given group name exists It returns true if successful. It returns false if the group does not exist.
Line 210 (5 lines)
Return: bool
Parameters: 1 (required: 1)
| Parameter | Type | Description | 
|---|---|---|
| <required> $sGroup | string | 
groupname to search for | 
๐น public generateContent()
Generate content for full htgroup file This method is used internally in the _saveFile() method. You can use this to render a preview of the generated file.
Line 112 (11 lines)
Return: string
Parameters: 0 (required: 0)
๐น public getFile()
Get current htgroup file
Line 159 (4 lines)
Return: string
Parameters: 0 (required: 0)
๐น public list()
List all groups as array.
with setting flag to show groupmembers you get an array
with 
Line 224 (5 lines)
Return: array
Parameters: 1 (required: 0)
| Parameter | Type | Description | 
|---|---|---|
| <optional> $sShowMembers | bool | 
optional: show groupmembers; default: false | 
๐น public members()
List members of a given existing group it returns
- an array of groupmembers if successful
 - false if group doesnโt exist
 
Line 239 (11 lines)
Return: array|bool
Parameters: 1 (required: 1)
| Parameter | Type | Description | 
|---|---|---|
| <required> $sGroup | string | 
groupname | 
๐น public remove()
Remove an existing group It returns true if successful. It returns false
- if group doesnโt exist
 - writing .htgroup file failed
 
Line 261 (11 lines)
Return: bool
Parameters: 1 (required: 1)
| Parameter | Type | Description | 
|---|---|---|
| <required> $sGroup | string | 
groupname to remove | 
๐น public rename()
Rename a group It returns true if successful. It returns false
- if group doesnโt exist
 - writing .htgroup file failed
 
Line 284 (11 lines)
Return: bool
Parameters: 2 (required: 2)
| Parameter | Type | Description | 
|---|---|---|
| <required> $sGroup | string | 
groupname to update | 
| <required> $sNewGroup | string | 
new groupname | 
๐น public setFile()
Set full path of htgroup file. If it exists its groups will be parsed.
Line 145 (9 lines)
Return: void
Parameters: 1 (required: 1)
| Parameter | Type | Description | 
|---|---|---|
| <required> $sHtGroupFile | string | 
optional: full path of htgroup file | 
๐น public userAdd()
Add a user to an existing group It returns true if successful. It returns false
- if group doesnโt exist
 - writing .htgroup file failed
 
Line 311 (14 lines)
Return: bool
Parameters: 2 (required: 2)
| Parameter | Type | Description | 
|---|---|---|
| <required> $sUser | string | 
username to add | 
| <required> $sGroup | string | 
group to add user to; this group must exist | 
๐น public userRemove()
Add a user to an existing group It returns true if successful. It returns false
- if group doesnโt exist
 - if the user in the given group doesnโt exist
 - writing .htgroup file failed
 
Line 338 (16 lines)
Return: bool
Parameters: 2 (required: 2)
| Parameter | Type | Description | 
|---|---|---|
| <required> $sUser | string | 
username to delete | 
| <required> $sGroup | string | 
group name where to delete the user from | 
Generated with Axels PHP class doc parser