Download the PHP package websitesql/utilities without Composer

On this page you can find all versions of the php package websitesql/utilities. 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 utilities

WebsiteSQL Utilities

A comprehensive collection of utility factory classes for common web development tasks.

Table of Contents

Installation

You can install the package via composer:

Usage

Basic Setup

The Utilities class serves as an entry point to access all other specialized factory classes. It provides static methods that instantiate and return factory objects for different domains.

UUID Generation

Generate and manipulate UUIDs of different versions:

String Manipulation

Perform various string operations with a fluent interface:

DateTime Handling

Manipulate dates and times with ease:

Pagination

Handle pagination and searching in arrays:

Security

Handle security-related operations:

File Operations

Work with files efficiently:

Validation

Validate user input:

API Reference

UuidFactory

Method Description
generate(string $version = '4'): UuidFactory Generates a UUID of the specified version
toString(): string Returns the UUID as a string
fromString(string $uuid): UuidFactory Creates a UUID object from a string
getVersion(): int Returns the UUID version

StringFactory

Method Description
random(int $length = 10, string $charset = 'alphanumeric'): StringFactory Generates a random string
slugify(): StringFactory Converts a string to a URL-friendly slug
encrypt(string $key, string $method = 'aes-256-cbc'): StringFactory Encrypts the string
decrypt(string $key, string $method = 'aes-256-cbc'): StringFactory Decrypts the string
truncate(int $length = 100, string $append = '...'): StringFactory Truncates the string to specified length
toString(): string Returns the string value

DateTimeFactory

Method Description
format(string $format = 'Y-m-d H:i:s'): string Formats the date using the specified format
timeAgo(): string Returns a human-readable time difference
setTimezone(string $timezone): DateTimeFactory Sets the timezone
modify(string $modifier): DateTimeFactory Modifies the date/time
diff(string $datetime): \DateInterval Returns the difference between dates
getDateTime(): DateTime Returns the PHP DateTime object
toString(string $format = 'Y-m-d H:i:s'): string Returns the formatted date string

PaginationFactory

Method Description
setData(array $data): PaginationFactory Sets the data to paginate
search(string $searchTerm, array $searchColumns = []): PaginationFactory Filters data by search term
paginate(int $offset = 0, int $limit = 10): PaginationFactory Sets pagination parameters
getResult(): array Returns the paginated results

SecurityFactory

Method Description
parseCookies(string $cookieHeader): array Parses cookies from a header string
parseAuthorization(string $authorizationHeader): ?string Extracts token from Authorization header
calculateExpiryDate(DateTime $createdAt, int $maxAge, int $refreshAge): DateTime Calculates token expiry date
generateCookieHeader(string $name, string $value, array $options = []): string Generates a cookie header
hashPassword(string $password): string Hashes a password using bcrypt
verifyPassword(string $password, string $hash): bool Verifies a password against a hash
generateCSRFToken(): string Generates a CSRF token
validateCSRFToken(string $token, string $storedToken): bool Validates a CSRF token

FileFactory

Method Description
open(string $filePath = null, string $mode = 'r'): FileFactory Opens a file
read(int $length = null): string Reads the file contents
write(string $data): FileFactory Writes data to the file
close(): void Closes the file handle
readCsv(bool $hasHeader = true): array Reads and parses a CSV file
writeCsv(array $data, bool $includeHeader = true): FileFactory Writes data to a CSV file

ValidationFactory

Method Description
date(string $date, string $format = 'm/d/Y', bool $strict = true): bool Validates a date string
email(string $email): bool Validates an email address
url(string $url): bool Validates a URL
ip(string $ip): bool Validates an IP address
required(string $value, string $fieldName): bool Checks if a value is not empty
minLength(string $value, int $length, string $fieldName): bool Validates minimum string length
maxLength(string $value, int $length, string $fieldName): bool Validates maximum string length
numeric(string $value, string $fieldName): bool Validates if a value is numeric
getErrors(): array Returns validation errors
hasErrors(): bool Checks if there are validation errors
clearErrors(): ValidationFactory Clears validation errors

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

The MIT License (MIT). Please see the License File for more information.


All versions of utilities with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
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 websitesql/utilities contains the following files

Loading the files please wait ...