Skip to content

Commit d7dd201

Browse files
committed
update README
1 parent 2c53a83 commit d7dd201

File tree

1 file changed

+36
-5
lines changed

1 file changed

+36
-5
lines changed

README.md

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
[![Total Downloads](https://img.shields.io/packagist/dt/nejcc/php-datatypes.svg?style=flat-square)](https://packagist.org/packages/nejcc/php-datatypes)
55
![GitHub Actions](https://github.com/nejcc/php-datatypes/actions/workflows/main.yml/badge.svg)
66

7-
This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.
8-
7+
PHP Datatypes is a flexible and efficient library for working with native data types, such as integers, floats, strings, and more. This package provides strict, type-safe operations and arithmetic for primitive data types, including extended support for different bit lengths (e.g., UInt8, Float32, etc.). It is built with extensibility in mind, making it easy to add more datatypes and custom behavior as needed.
98
## Installation
109

1110
You can install the package via composer:
@@ -16,8 +15,42 @@ composer require nejcc/php-datatypes
1615

1716
## Usage
1817

18+
Below are examples of how to use the basic integer and float classes in your project.
19+
20+
### Integers
21+
```php
22+
use Nejcc\PhpDatatypes\Integers\Signed\Int8;
23+
use Nejcc\PhpDatatypes\Integers\Unsigned\UInt8;
24+
25+
$int8 = new Int8(-128); // Minimum value for Int8
26+
echo $int8->getValue(); // -128
27+
28+
$uint8 = new UInt8(255); // Maximum value for UInt8
29+
echo $uint8->getValue(); // 255
30+
```
31+
32+
### Floats
33+
```php
34+
use Nejcc\PhpDatatypes\Floats\Float32;
35+
use Nejcc\PhpDatatypes\Floats\Float64;
36+
37+
$float32 = new Float32(3.14);
38+
echo $float32->getValue(); // 3.14
39+
40+
$float64 = new Float64(1.7976931348623157e308); // Maximum value for Float64
41+
echo $float64->getValue(); // 1.7976931348623157e308
42+
```
43+
44+
### Arithmetic Operations
1945
```php
20-
// Usage description here
46+
use Nejcc\PhpDatatypes\Integers\Signed\Int8;
47+
48+
$int1 = new Int8(50);
49+
$int2 = new Int8(30);
50+
51+
$result = $int1->add($int2); // Performs addition
52+
echo $result->getValue(); // 80
53+
2154
```
2255

2356
### Testing
@@ -39,9 +72,7 @@ Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
3972
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
4073

4174
## Credits
42-
4375
- [Nejc Cotic](https://github.com/nejcc)
44-
- [All Contributors](../../contributors)
4576

4677
## License
4778

0 commit comments

Comments
 (0)