Skip to content

Commit 5d72155

Browse files
authored
Merge pull request #2 from codebar-ag/feature-v1
Feature V1
2 parents 289dfdb + c041516 commit 5d72155

File tree

4 files changed

+118
-10
lines changed

4 files changed

+118
-10
lines changed

.github/workflows/phpstan.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ jobs:
1616
- name: Setup PHP
1717
uses: shivammathur/setup-php@v2
1818
with:
19-
php-version: '8.1'
19+
php-version: '8.2'
2020
coverage: none
2121

2222
- name: Install composer dependencies
23-
uses: ramsey/composer-install@v1
23+
uses: ramsey/composer-install@v2
2424

2525
- name: Run PHPStan
2626
run: ./vendor/bin/phpstan --error-format=github

README.md

Lines changed: 111 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,18 @@
44
[![Total Downloads](https://img.shields.io/packagist/dt/codebar-ag/laravel-flatfox.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/laravel-flatfox)
55
[![run-tests](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/run-tests.yml/badge.svg)](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/run-tests.yml)
66
[![PHPStan](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/phpstan.yml/badge.svg)](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/phpstan.yml)
7-
[![Check & fix styling](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/php-cs-fixer.yml)
87

98
This package was developed to give you a quick start to receive public listings from the Flatfox API.
109

1110
## 💡 What is Flatfox?
1211

13-
Flatfox is a web based portal whereh you can Search & advertise apartments for free.
12+
Flatfox is a web based portal where you can Search & advertise apartments for free.
1413

1514
## 🛠 Requirements
1615

17-
| Package | PHP | Laravel | Flatfox |
18-
|-----------|--------|------------------|-----------|
19-
| >v1.0 | >8.2 | > Laravel 10.0 ||
16+
| Package | PHP | Laravel | Flatfox |
17+
|-----------|-------|----------------|-----------|
18+
| >v1.0 | >8.2 | > Laravel 10.0 ||
2019

2120
## ⚙️ Installation
2221

@@ -31,6 +30,113 @@ composer require codebar-ag/laravel-flatfox
3130
```php
3231
$request = new GetPublicListing(142, '&expand=documents&expand=images');
3332
$response = $request->send();
33+
34+
$status = $request->status();
35+
$dto = $request->dto();
36+
37+
```
38+
39+
## 🏋️ DTO showcase
40+
41+
```php
42+
CodebarAg\Flatfox\DTO\Listing {
43+
+pk: int|null
44+
+slug: string|null
45+
+url: array|null
46+
+short_url: string|null
47+
+submit_url: array|null
48+
+status: string|null
49+
+offer_type: string|null
50+
+object_category: string|null
51+
+object_type: string|null
52+
+reference: string|null
53+
+ref_property: string|null
54+
+ref_house: string|null
55+
+ref_object: string|null
56+
+alternative_reference: string|null
57+
+price_display: int|null
58+
+price_display_type: string|null
59+
+price_unit: string|null
60+
+rent_net: int|null
61+
+rent_charges: int|null
62+
+rent_gross: int|null
63+
+short_title: string|null
64+
+public_title: string|null
65+
+pitch_title: string|null
66+
+description_title: string|null
67+
+description: string|null
68+
+surface_living: int|null
69+
+surface_property: int|null
70+
+surface_usable: int|null
71+
+surface_usable_minimum: int|null
72+
+volume: int|null
73+
+space_display: int|null
74+
+number_of_rooms: string|null
75+
+floor: int|null
76+
+attributes: Collection DTO/Attribute|null
77+
+is_furnished: boolean|null
78+
+is_temporary: boolean|null
79+
+is_selling_furniture: boolean|null
80+
+street: string|null
81+
+zipcode: int|null
82+
+city: string|null
83+
+public_address: string|null
84+
+latitude: float|null
85+
+longitude: float|null
86+
+year_built: int|null
87+
+year_renovated: int|null
88+
+moving_date_type: string|null
89+
+moving_date: Carbon|null
90+
+video_url: string|null
91+
+tour_url: string|null
92+
+website_url: string|null
93+
+live_viewing_url: string|null
94+
+cover_image: int|null
95+
+images: Collection DTO/Image|null
96+
+documents: Collection DTO/Documenent|null
97+
+agency: DTO/Agency|null
98+
+reserved: boolean|null
99+
+livingspace: boolean|null
100+
+published: Carbon|null
101+
+created: Carbon|null
102+
```
103+
104+
```php
105+
CodebarAg\Flatfox\DTO\Attribute {
106+
+name: string|null
107+
+name_2: string|null
108+
+street: string|null
109+
+zipcode: string|null
110+
+city: string|null
111+
+country: string|null
112+
+logo_url: string|null
113+
+logo_url_org_logo_m: string|null
114+
```
115+
116+
```php
117+
CodebarAg\Flatfox\DTO\Agency {
118+
+name: string|null
119+
```
120+
121+
```php
122+
CodebarAg\Flatfox\DTO\Image {
123+
+pk: int|null
124+
+caption: string|null
125+
+url: string|null
126+
+url_thumb_m: string|null
127+
+url_listing_search: string|null
128+
+search_url: string|null
129+
+ordering: int|null
130+
+width: int|null
131+
+height: int|null
132+
```
133+
134+
```php
135+
CodebarAg\Flatfox\DTO\Document {
136+
+pk: int|null
137+
+url: string|null
138+
+ordering: int|null
139+
+caption: sting|null
34140
```
35141

36142
## 🚧 Testing

src/DTO/Agency.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,17 @@ public function __construct(
2020

2121
public static function fromJson(array $data): self
2222
{
23+
$endpoint = trim(config('flatfox.endpoint', 'https://flatfox.ch'), '/');
24+
2325
return new self(
2426
name: Arr::get($data, 'name'),
2527
name_2: Arr::get($data, 'name'),
2628
street: Arr::get($data, 'street'),
2729
zipcode: Arr::get($data, 'zipcode'),
2830
city: Arr::get($data, 'city'),
2931
country: Arr::get($data, 'country'),
30-
logo_url: Arr::get($data, 'logo.url'),
31-
logo_url_org_logo_m: Arr::get($data, 'logo.url_org_logo_m'),
32+
logo_url: $endpoint.Arr::get($data, 'logo.url'),
33+
logo_url_org_logo_m: $endpoint.Arr::get($data, 'logo.url_org_logo_m'),
3234
);
3335
}
3436
}

src/Response/PublicListing.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static function fromResponse(Response $response): self
2121
{
2222
$data = $response->json();
2323

24-
return new static(
24+
return new self(
2525
Arr::get($data, 'count'),
2626
Arr::get($data, 'next'),
2727
Arr::get($data, 'previous'),

0 commit comments

Comments
 (0)