https://github.com/jansenfelipe/phpstring
Create objects filling attribute classes with string data
https://github.com/jansenfelipe/phpstring
Last synced: 3 months ago
JSON representation
Create objects filling attribute classes with string data
- Host: GitHub
- URL: https://github.com/jansenfelipe/phpstring
- Owner: jansenfelipe
- Created: 2016-06-23T18:32:40.000Z (about 9 years ago)
- Default Branch: 1.0
- Last Pushed: 2022-01-17T17:32:26.000Z (over 3 years ago)
- Last Synced: 2025-03-22T05:13:46.983Z (4 months ago)
- Language: PHP
- Size: 16.6 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# PHP String
[](https://travis-ci.org/jansenfelipe/phpstring)
[](https://packagist.org/packages/jansenfelipe/phpstring)
[](https://packagist.org/packages/jansenfelipe/phpstring)
[](https://packagist.org/packages/jansenfelipe/phpstring)
[](http://opensource.org/licenses/MIT)Create objects filling attribute classes with string data
## How to use
Add library
```sh
$ composer require jansenfelipe/phpstring
```Add autoload.php in your file:
```php
require_once 'vendor/autoload.php';
```Add annotations
```php
Object```php
$parser = new PHPString(Event::class);
$event = $parser->toObject("BH Bike Show 20160621002000Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce consequat augue at hendrerit posuere.");echo $parser->getSize(); //output: 134
```#### String <- Object
```php
$parser = new PHPString(Event::class);$event = new Event();
$event->name = 'Motocross Adventure';
$event->description = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce consequat augue at hendrerit posuere.';
$event->date = Carbon::createFromFormat('Y-m-d', '2016-06-21');
$event->price = 1200.98;$string = $parser->toString($event);
```### License
The MIT License (MIT)