@@ -21,7 +21,6 @@ Lark is a modern, lightweight app framework designed specifically for developing
2121- [ Validator] ( #validator )
2222 - [ Validation Types & Rules] ( #validation-types--rules )
2323- [ Filter] ( #filter )
24- - [ Entity] ( #entity )
2524- [ HTTP Client] ( #http-client )
2625- [ CLI] ( #cli )
2726- [ File] ( #file )
@@ -1927,48 +1926,6 @@ print_r(
19271926- ` string($value, array $options = ['flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH]): string ` - sanitize value with string filter
19281927- ` url($value, array $options = []): string ` - sanitize value with url filter
19291928
1930- ## Entity
1931-
1932- ` Lark\Factory\Entity ` is used for mapping class properties to array and array to class properties.
1933-
1934- ``` php
1935- use Lark\Factory\Entity;
1936-
1937- // class must be subclass of Entity
1938- class Location extends Entity
1939- {
1940- public string $address;
1941- public string $city;
1942- }
1943-
1944- class User extends Entity
1945- {
1946- // properties must be public and typed
1947- // union types are not supported
1948- public string $name;
1949- public int $age;
1950- public bool $isActive = false; // default values
1951- public Location $location; // deep nested classes supported
1952- }
1953-
1954- // populate from array
1955- $user = new User([
1956- 'name' => 'Bob',
1957- 'age' => 25,
1958- 'location' => [
1959- 'address' => '101 main',
1960- 'city' => 'Tampa'
1961- ]
1962- ]);
1963- // or use: $user->fromArray([...])
1964-
1965- echo $user->name; // Bob
1966- echo $user->location->address; // 101 main
1967-
1968- // get as array
1969- $userArr = $user->toArray(); // [name => Bob, ...]
1970- ```
1971-
19721929## HTTP Client
19731930
19741931` Lark\Http\Client ` is an HTTP client.
0 commit comments