Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jansenfelipe/phpstring
Create objects filling attribute classes with string data
https://github.com/jansenfelipe/phpstring
Last synced: 3 days 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 (over 8 years ago)
- Default Branch: 1.0
- Last Pushed: 2022-01-17T17:32:26.000Z (almost 3 years ago)
- Last Synced: 2024-10-28T15:39:52.286Z (11 days ago)
- Language: PHP
- Size: 16.6 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# PHP String
[![Travis](https://travis-ci.org/jansenfelipe/phpstring.svg?branch=1.0)](https://travis-ci.org/jansenfelipe/phpstring)
[![Latest Stable Version](https://poser.pugx.org/jansenfelipe/phpstring/v/stable.svg)](https://packagist.org/packages/jansenfelipe/phpstring)
[![Total Downloads](https://poser.pugx.org/jansenfelipe/phpstring/downloads.svg)](https://packagist.org/packages/jansenfelipe/phpstring)
[![Latest Unstable Version](https://poser.pugx.org/jansenfelipe/phpstring/v/unstable.svg)](https://packagist.org/packages/jansenfelipe/phpstring)
[![MIT license](https://poser.pugx.org/jansenfelipe/phpstring/license.svg)](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)