Skip to content

Commit ccfaf1d

Browse files
authored
Merge pull request #58 from programmatordev/2.x
v2.0.0
2 parents 4c9ec02 + d85a3b8 commit ccfaf1d

File tree

123 files changed

+3595
-3378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+3595
-3378
lines changed

.ddev/config.yaml

+282
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
name: openweathermap-php-api
2+
type: php
3+
docroot: ""
4+
php_version: "8.1"
5+
webserver_type: nginx-fpm
6+
xdebug_enabled: false
7+
additional_hostnames: []
8+
additional_fqdns: []
9+
database:
10+
type: mariadb
11+
version: "10.11"
12+
omit_containers: [db]
13+
use_dns_when_possible: true
14+
composer_version: "2"
15+
web_environment: []
16+
corepack_enable: false
17+
disable_upload_dirs_warning: true
18+
19+
# Key features of DDEV's config.yaml:
20+
21+
# name: <projectname> # Name of the project, automatically provides
22+
# http://projectname.ddev.site and https://projectname.ddev.site
23+
24+
# type: <projecttype> # backdrop, craftcms, django4, drupal, drupal6, drupal7, laravel, magento, magento2, php, python, shopware6, silverstripe, typo3, wordpress
25+
# See https://ddev.readthedocs.io/en/stable/users/quickstart/ for more
26+
# information on the different project types
27+
# "drupal" covers recent Drupal 8+
28+
29+
# docroot: <relative_path> # Relative path to the directory containing index.php.
30+
31+
# php_version: "8.2" # PHP version to use, "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3"
32+
33+
# You can explicitly specify the webimage but this
34+
# is not recommended, as the images are often closely tied to DDEV's' behavior,
35+
# so this can break upgrades.
36+
37+
# webimage: <docker_image> # nginx/php docker image.
38+
39+
# database:
40+
# type: <dbtype> # mysql, mariadb, postgres
41+
# version: <version> # database version, like "10.11" or "8.0"
42+
# MariaDB versions can be 5.5-10.8 and 10.11, MySQL versions can be 5.5-8.0
43+
# PostgreSQL versions can be 9-16.
44+
45+
# router_http_port: <port> # Port to be used for http (defaults to global configuration, usually 80)
46+
# router_https_port: <port> # Port for https (defaults to global configuration, usually 443)
47+
48+
# xdebug_enabled: false # Set to true to enable Xdebug and "ddev start" or "ddev restart"
49+
# Note that for most people the commands
50+
# "ddev xdebug" to enable Xdebug and "ddev xdebug off" to disable it work better,
51+
# as leaving Xdebug enabled all the time is a big performance hit.
52+
53+
# xhprof_enabled: false # Set to true to enable Xhprof and "ddev start" or "ddev restart"
54+
# Note that for most people the commands
55+
# "ddev xhprof" to enable Xhprof and "ddev xhprof off" to disable it work better,
56+
# as leaving Xhprof enabled all the time is a big performance hit.
57+
58+
# webserver_type: nginx-fpm, apache-fpm, or nginx-gunicorn
59+
60+
# timezone: Europe/Berlin
61+
# This is the timezone used in the containers and by PHP;
62+
# it can be set to any valid timezone,
63+
# see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
64+
# For example Europe/Dublin or MST7MDT
65+
66+
# composer_root: <relative_path>
67+
# Relative path to the Composer root directory from the project root. This is
68+
# the directory which contains the composer.json and where all Composer related
69+
# commands are executed.
70+
71+
# composer_version: "2"
72+
# You can set it to "" or "2" (default) for Composer v2 or "1" for Composer v1
73+
# to use the latest major version available at the time your container is built.
74+
# It is also possible to use each other Composer version channel. This includes:
75+
# - 2.2 (latest Composer LTS version)
76+
# - stable
77+
# - preview
78+
# - snapshot
79+
# Alternatively, an explicit Composer version may be specified, for example "2.2.18".
80+
# To reinstall Composer after the image was built, run "ddev debug refresh".
81+
82+
# nodejs_version: "20"
83+
# change from the default system Node.js version to any other version.
84+
# Numeric version numbers can be complete (i.e. 18.15.0) or
85+
# incomplete (18, 17.2, 16). 'lts' and 'latest' can be used as well along with
86+
# other named releases.
87+
# see https://www.npmjs.com/package/n#specifying-nodejs-versions
88+
# Note that you can continue using 'ddev nvm' or nvm inside the web container
89+
# to change the project's installed node version if you need to.
90+
91+
# corepack_enable: false
92+
# Change to 'true' to 'corepack enable' and gain access to latest versions of yarn/pnpm
93+
94+
# additional_hostnames:
95+
# - somename
96+
# - someothername
97+
# would provide http and https URLs for "somename.ddev.site"
98+
# and "someothername.ddev.site".
99+
100+
# additional_fqdns:
101+
# - example.com
102+
# - sub1.example.com
103+
# would provide http and https URLs for "example.com" and "sub1.example.com"
104+
# Please take care with this because it can cause great confusion.
105+
106+
# upload_dirs: "custom/upload/dir"
107+
#
108+
# upload_dirs:
109+
# - custom/upload/dir
110+
# - ../private
111+
#
112+
# would set the destination paths for ddev import-files to <docroot>/custom/upload/dir
113+
# When Mutagen is enabled this path is bind-mounted so that all the files
114+
# in the upload_dirs don't have to be synced into Mutagen.
115+
116+
# disable_upload_dirs_warning: false
117+
# If true, turns off the normal warning that says
118+
# "You have Mutagen enabled and your 'php' project type doesn't have upload_dirs set"
119+
120+
# ddev_version_constraint: ""
121+
# Example:
122+
# ddev_version_constraint: ">= 1.22.4"
123+
# This will enforce that the running ddev version is within this constraint.
124+
# See https://github.com/Masterminds/semver#checking-version-constraints for
125+
# supported constraint formats
126+
127+
# working_dir:
128+
# web: /var/www/html
129+
# db: /home
130+
# would set the default working directory for the web and db services.
131+
# These values specify the destination directory for ddev ssh and the
132+
# directory in which commands passed into ddev exec are run.
133+
134+
# omit_containers: [db, ddev-ssh-agent]
135+
# Currently only these containers are supported. Some containers can also be
136+
# omitted globally in the ~/.ddev/global_config.yaml. Note that if you omit
137+
# the "db" container, several standard features of DDEV that access the
138+
# database container will be unusable. In the global configuration it is also
139+
# possible to omit ddev-router, but not here.
140+
141+
# performance_mode: "global"
142+
# DDEV offers performance optimization strategies to improve the filesystem
143+
# performance depending on your host system. Should be configured globally.
144+
#
145+
# If set, will override the global config. Possible values are:
146+
# - "global": uses the value from the global config.
147+
# - "none": disables performance optimization for this project.
148+
# - "mutagen": enables Mutagen for this project.
149+
# - "nfs": enables NFS for this project.
150+
#
151+
# See https://ddev.readthedocs.io/en/stable/users/install/performance/#nfs
152+
# See https://ddev.readthedocs.io/en/stable/users/install/performance/#mutagen
153+
154+
# fail_on_hook_fail: False
155+
# Decide whether 'ddev start' should be interrupted by a failing hook
156+
157+
# host_https_port: "59002"
158+
# The host port binding for https can be explicitly specified. It is
159+
# dynamic unless otherwise specified.
160+
# This is not used by most people, most people use the *router* instead
161+
# of the localhost port.
162+
163+
# host_webserver_port: "59001"
164+
# The host port binding for the ddev-webserver can be explicitly specified. It is
165+
# dynamic unless otherwise specified.
166+
# This is not used by most people, most people use the *router* instead
167+
# of the localhost port.
168+
169+
# host_db_port: "59002"
170+
# The host port binding for the ddev-dbserver can be explicitly specified. It is dynamic
171+
# unless explicitly specified.
172+
173+
# mailpit_http_port: "8025"
174+
# mailpit_https_port: "8026"
175+
# The Mailpit ports can be changed from the default 8025 and 8026
176+
177+
# host_mailpit_port: "8025"
178+
# The mailpit port is not normally bound on the host at all, instead being routed
179+
# through ddev-router, but it can be bound directly to localhost if specified here.
180+
181+
# webimage_extra_packages: [php7.4-tidy, php-bcmath]
182+
# Extra Debian packages that are needed in the webimage can be added here
183+
184+
# dbimage_extra_packages: [telnet,netcat]
185+
# Extra Debian packages that are needed in the dbimage can be added here
186+
187+
# use_dns_when_possible: true
188+
# If the host has internet access and the domain configured can
189+
# successfully be looked up, DNS will be used for hostname resolution
190+
# instead of editing /etc/hosts
191+
# Defaults to true
192+
193+
# project_tld: ddev.site
194+
# The top-level domain used for project URLs
195+
# The default "ddev.site" allows DNS lookup via a wildcard
196+
# If you prefer you can change this to "ddev.local" to preserve
197+
# pre-v1.9 behavior.
198+
199+
# ngrok_args: --basic-auth username:pass1234
200+
# Provide extra flags to the "ngrok http" command, see
201+
# https://ngrok.com/docs/ngrok-agent/config or run "ngrok http -h"
202+
203+
# disable_settings_management: false
204+
# If true, DDEV will not create CMS-specific settings files like
205+
# Drupal's settings.php/settings.ddev.php or TYPO3's AdditionalConfiguration.php
206+
# In this case the user must provide all such settings.
207+
208+
# You can inject environment variables into the web container with:
209+
# web_environment:
210+
# - SOMEENV=somevalue
211+
# - SOMEOTHERENV=someothervalue
212+
213+
# no_project_mount: false
214+
# (Experimental) If true, DDEV will not mount the project into the web container;
215+
# the user is responsible for mounting it manually or via a script.
216+
# This is to enable experimentation with alternate file mounting strategies.
217+
# For advanced users only!
218+
219+
# bind_all_interfaces: false
220+
# If true, host ports will be bound on all network interfaces,
221+
# not the localhost interface only. This means that ports
222+
# will be available on the local network if the host firewall
223+
# allows it.
224+
225+
# default_container_timeout: 120
226+
# The default time that DDEV waits for all containers to become ready can be increased from
227+
# the default 120. This helps in importing huge databases, for example.
228+
229+
#web_extra_exposed_ports:
230+
#- name: nodejs
231+
# container_port: 3000
232+
# http_port: 2999
233+
# https_port: 3000
234+
#- name: something
235+
# container_port: 4000
236+
# https_port: 4000
237+
# http_port: 3999
238+
# Allows a set of extra ports to be exposed via ddev-router
239+
# Fill in all three fields even if you don’t intend to use the https_port!
240+
# If you don’t add https_port, then it defaults to 0 and ddev-router will fail to start.
241+
#
242+
# The port behavior on the ddev-webserver must be arranged separately, for example
243+
# using web_extra_daemons.
244+
# For example, with a web app on port 3000 inside the container, this config would
245+
# expose that web app on https://<project>.ddev.site:9999 and http://<project>.ddev.site:9998
246+
# web_extra_exposed_ports:
247+
# - name: myapp
248+
# container_port: 3000
249+
# http_port: 9998
250+
# https_port: 9999
251+
252+
#web_extra_daemons:
253+
#- name: "http-1"
254+
# command: "/var/www/html/node_modules/.bin/http-server -p 3000"
255+
# directory: /var/www/html
256+
#- name: "http-2"
257+
# command: "/var/www/html/node_modules/.bin/http-server /var/www/html/sub -p 3000"
258+
# directory: /var/www/html
259+
260+
# override_config: false
261+
# By default, config.*.yaml files are *merged* into the configuration
262+
# But this means that some things can't be overridden
263+
# For example, if you have 'use_dns_when_possible: true'' you can't override it with a merge
264+
# and you can't erase existing hooks or all environment variables.
265+
# However, with "override_config: true" in a particular config.*.yaml file,
266+
# 'use_dns_when_possible: false' can override the existing values, and
267+
# hooks:
268+
# post-start: []
269+
# or
270+
# web_environment: []
271+
# or
272+
# additional_hostnames: []
273+
# can have their intended affect. 'override_config' affects only behavior of the
274+
# config.*.yaml file it exists in.
275+
276+
# Many DDEV commands can be extended to run tasks before or after the
277+
# DDEV command is executed, for example "post-start", "post-import-db",
278+
# "pre-composer", "post-composer"
279+
# See https://ddev.readthedocs.io/en/stable/users/extend/custom-commands/ for more
280+
# information on the commands that can be extended and the tasks you can define
281+
# for them. Example:
282+
#hooks:

README.md

+9-20
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,26 @@ You must sign up for an [OpenWeatherMap account](https://openweathermap.org/appi
1919

2020
## Installation
2121

22-
You can install the library via [Composer](https://getcomposer.org/):
22+
Install the library via [Composer](https://getcomposer.org/):
2323

2424
```bash
2525
composer require programmatordev/openweathermap-php-api
2626
```
2727

28-
To use the library, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):
29-
30-
```php
31-
require_once 'vendor/autoload.php';
32-
```
33-
3428
## Basic Usage
3529

3630
Simple usage looks like:
3731

3832
```php
39-
use ProgrammatorDev\OpenWeatherMap\Config;
4033
use ProgrammatorDev\OpenWeatherMap\OpenWeatherMap;
4134

42-
// Initialize
43-
$openWeatherMap = new OpenWeatherMap(
44-
new Config([
45-
'applicationKey' => 'yourappkey'
46-
])
47-
);
48-
49-
// Get current weather by coordinate (latitude, longitude)
50-
$currentWeather = $openWeatherMap->weather()->getCurrent(50, 50);
51-
// Show current temperature
52-
echo $currentWeather->getTemperature();
35+
// initialize
36+
$api = new OpenWeatherMap('yourapikey');
37+
38+
// get current weather by coordinate (latitude, longitude)
39+
$weather = $api->weather()->getCurrent(50, 50);
40+
// show current temperature
41+
echo $weather->getTemperature();
5342
```
5443

5544
## Documentation
@@ -58,7 +47,7 @@ echo $currentWeather->getTemperature();
5847
- [Configuration](docs/02-configuration.md)
5948
- [Supported APIs](docs/03-supported-apis.md)
6049
- [Error Handling](docs/04-error-handling.md)
61-
- [Objects](docs/05-objects.md)
50+
- [Entities](docs/05-entities.md)
6251

6352
## Contributing
6453

composer.json

+10-17
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,29 @@
22
"name": "programmatordev/openweathermap-php-api",
33
"description": "OpenWeatherMap PHP library that provides convenient access to the OpenWeatherMap API",
44
"type": "library",
5-
"keywords": ["OpenWeatherMap", "API", "PHP", "PHP8", "SDK", "PSR-18", "PSR-17", "PSR-6", "PSR-3"],
5+
"keywords": ["openweathermap", "api", "php", "php8", "sdk", "psr-18", "psr-17", "psr-6", "psr-3"],
66
"license": "MIT",
77
"authors": [
88
{
99
"name": "André Pimpão",
1010
"email": "[email protected]",
11-
"homepage": "https://programmator.dev/"
11+
"homepage": "https://programmator.dev"
1212
}
1313
],
1414
"require": {
1515
"php": ">=8.1",
16-
"php-http/cache-plugin": "^1.8",
17-
"php-http/client-common": "^2.7",
18-
"php-http/discovery": "^1.18",
19-
"php-http/logger-plugin": "^1.3",
20-
"programmatordev/yet-another-php-validator": "^0.5",
21-
"psr/cache": "^2.0 || ^3.0",
22-
"psr/http-client": "^1.0",
23-
"psr/http-factory": "^1.0",
24-
"psr/log": "^2.0 || ^3.0",
25-
"symfony/options-resolver": "^6.3"
16+
"myclabs/deep-copy": "^1.11",
17+
"programmatordev/php-api-sdk": "^0.2.0",
18+
"programmatordev/yet-another-php-validator": "^1.1"
2619
},
2720
"require-dev": {
28-
"monolog/monolog": "^3.4",
21+
"monolog/monolog": "^3.6",
2922
"nyholm/psr7": "^1.8",
3023
"php-http/mock-client": "^1.6",
31-
"phpunit/phpunit": "^10.0",
32-
"symfony/cache": "^6.3",
33-
"symfony/http-client": "^6.3",
34-
"symfony/var-dumper": "^6.3"
24+
"phpunit/phpunit": "^10.5",
25+
"symfony/cache": "^6.4",
26+
"symfony/http-client": "^6.4",
27+
"symfony/var-dumper": "^6.4"
3528
},
3629
"provide": {
3730
"psr/http-client-implementation": "1.0",

0 commit comments

Comments
 (0)