Download .zip |
Info | Documentation | View files (100) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2019-10-20 (2 days ago) | Not yet rated by the users | Total: 2 This week: 2 | All time: 9,745 This week: 202 |
Version | License | PHP version | Categories | |||
importcsvuser 1.0 | MIT/X Consortium ... | 5 | PHP 5, Databases, User Management |
Description | Author | |
This class can be used to import user data from CSV files into MySQL. |
|
ImportCsvUser is a console application to help import User's data from CSV (comma separated value) to MySQL. Project is working for specific CSV structure where first row acts as a schema.
Additionally ImportCsvUser has:
composer install
php bin/console doctrine:database:create
ImportCsvUser supports commands:
* user:import-csv
: import csv file to database
* user:age-average
: get age average
_Note_: all example command SHOULD be run inside import-web
container.
Please execute php bin/console user:import-csv -h
to see how to use command.
In that example is importing valid user file.
Please execute:
php bin/console user:import-csv --path ./doc/csv/user.valid.csv
As execution result:
Imported: 5
Skipped: 0
In that example file contains some invalid rows.
Please execute command:
php bin/console user:import-csv --path ./doc/csv/user.valid.csv
As execution result:
Imported: 2
Skipped: 3
Line #1: Invalid parameter 'firstName'. This value should not be blank.
Line #1: Invalid parameter 'gender'. Choose a valid gender.
Line #5: Invalid parameter 'zipCode'. This value is too long. It should have 32 character or less.
Line #7: Invalid parameter 'birthDate'. This value is not a valid date.
Please run php bin/console user:age-average -h
to see how to use command.
Please execute command:
php bin/console user:age-average
As execution result:
Average male age: 32.12
Average female age: 30.26
File SHOULD has delimiter ,
with enclosure "
.
First row in csv file is a schema. It is important the column name not an order.
Table bellow describes column name.
name/characteristics | firstname | infix | lastname | date of birth | gender | zipcode | housenumber --- | --- | --- | --- | --- | --- | --- | --- required | yes | no | no | no | no | no | no has normalizers | no | no | no | no | tim, lowercase | trim, uppercase | no data type | String[2-255] | String[0-45] | String[0-255] | Date[Y-m-d] | String['m', 'f'] | String[0-32] | String[0-255] example | Nick | ter | Tester | 1991-08-24 | m | 12010 | 9b
_Note_: column name SHOULD start form alphabetic character. It case if it's present some non alphabetic character it will be
remove and application try to map columns with sanitized column name. For instance if the original column name # firstname
ImportCsvUser converts it to firstname
.
Rows that has first column started with #
are skipped.
Normalizers helps to clean users data of get the right format.
Here is a normalizer list:
The data validators skip rows and write the report result with keeping process running.
There is a list of validators:
firstname
: required, max length 255infix
: max length 45lastname
: max length 255gender
: m
or f
birthday
: date yyyy-mm-dd
zipcode
: max length 32housenumber
: max length 255If you find this project worth to use please add a star. Follow changes to see all activities. And if you see room for improvement, proposals please feel free to create an issue or send pull request. Here is a great guide to start contributing.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project and its community you agree to abide by those terms.
ImportCsvUser is licensed under the MIT License. Please see the LICENSE file for details.
Files |
File | Role | Description | ||
---|---|---|---|---|
app (4 files, 2 directories) | ||||
bin (2 files) | ||||
dev (1 directory) | ||||
doc (3 directories) | ||||
src (1 file, 1 directory) | ||||
tests (1 directory) | ||||
var (1 file) | ||||
web (7 files) | ||||
.travis.yml | Data | Auxiliary data | ||
CHANGELOG.md | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
FEATURE.CANDIDATE.md | Data | Auxiliary data | ||
LICENSE.txt | Doc. | Documentation | ||
phpunit.xml.dist | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files | / | app |
File | Role | Description | ||
---|---|---|---|---|
config (9 files) | ||||
Resources (1 directory) | ||||
.htaccess | Data | Auxiliary data | ||
AppCache.php | Class | Class source | ||
AppKernel.php | Class | Class source | ||
autoload.php | Aux. | Auxiliary script |
Files | / | app | / | config |
File | Role | Description |
---|---|---|
config.yml | Data | Auxiliary data |
config_dev.yml | Data | Auxiliary data |
config_prod.yml | Data | Auxiliary data |
config_test.yml | Data | Auxiliary data |
parameters.yml.dist | Data | Auxiliary data |
routing.yml | Data | Auxiliary data |
routing_dev.yml | Data | Auxiliary data |
security.yml | Data | Auxiliary data |
services.yml | Data | Auxiliary data |
Files | / | app | / | Resources | / | views |
File | Role | Description | ||
---|---|---|---|---|
default (1 file) | ||||
base.html.twig | Data | Auxiliary data |
Files | / | bin |
File | Role | Description |
---|---|---|
console | Example | Example script |
symfony_requirements | Example | Example script |
Files | / | dev | / | docker |
File | Role | Description | ||
---|---|---|---|---|
web (1 file, 1 directory) | ||||
docker-compose.yml | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files | / | doc | / | csv |
File | Role | Description |
---|---|---|
user.invalid.csv | Data | Auxiliary data |
user.valid.csv | Data | Auxiliary data |
Files | / | doc | / | db |
File | Role | Description |
---|---|---|
import_csv_user.png | Icon | Icon image |
README.md | Doc. | Documentation |
Files | / | doc | / | uml |
File | Role | Description |
---|---|---|
class.diagram.png | Data | Auxiliary data |
README.md | Doc. | Documentation |
Files | / | src | / | AppBundle |
File | Role | Description | ||
---|---|---|---|---|
Command (2 files) | ||||
Controller (1 file) | ||||
Entity (1 file) | ||||
Model (1 file, 6 directories) | ||||
Repository (1 file) | ||||
Resources (1 directory) | ||||
Service (2 files) | ||||
AppBundle.php | Class | Class source |
Files | / | src | / | AppBundle | / | Command |
File | Role | Description |
---|---|---|
UserAgeAverageCommand.php | Class | Class source |
UserImportCsvCommand.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Api |
File | Role | Description | ||
---|---|---|---|---|
Builder (2 files) | ||||
Csv (3 files, 2 directories) | ||||
Data (2 files) | ||||
Entity (1 file) | ||||
Manager (1 file) | ||||
Repository (1 file) | ||||
ObjectManagerInterface.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Api | / | Builder |
File | Role | Description |
---|---|---|
ImportResultFactoryInterface.php | Class | Class source |
ImportUserFactoryInterface.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Api | / | Csv |
File | Role | Description | ||
---|---|---|---|---|
Builder (4 files) | ||||
Data (1 file) | ||||
ReaderFilterIteratorInterface.php | Class | Class source | ||
ReaderInterface.php | Class | Class source | ||
RowFilterInterface.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Api | / | Csv | / | Builder |
File | Role | Description |
---|---|---|
PathFactoryInterface.php | Class | Class source |
ReaderFactoryInterface.php | Class | Class source |
ReaderFilterIteratorFactoryInterface.php | Class | Class source |
RowFactoryInterface.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Api | / | Csv | / | Data |
File | Role | Description |
---|---|---|
RowInterface.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Api | / | Data |
File | Role | Description |
---|---|---|
ImportResultInterface.php | Class | Class source |
PathInterface.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Api | / | Entity |
File | Role | Description |
---|---|---|
ImportUserInterface.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Api | / | Manager |
File | Role | Description |
---|---|---|
ImportUserManagerInterface.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Api | / | Repository |
File | Role | Description |
---|---|---|
ImportUserRepositoryInterface.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Builder |
File | Role | Description |
---|---|---|
ImportResultFactory.php | Class | Class source |
ImportUserFactory.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Csv |
File | Role | Description | ||
---|---|---|---|---|
Builder (4 files) | ||||
Data (2 files) | ||||
Filter (1 file) | ||||
Reader.php | Class | Class source | ||
ReaderFilterIterator.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Csv | / | Builder |
File | Role | Description |
---|---|---|
PathFactory.php | Class | Class source |
ReaderFactory.php | Class | Class source |
ReaderFilterIteratorFactory.php | Class | Class source |
RowFactory.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Csv | / | Filter |
File | Role | Description |
---|---|---|
CommentFilter.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Exception |
File | Role | Description |
---|---|---|
ExceptionInterface.php | Class | Class source |
InvalidArgumentException.php | Class | Class source |
RuntimeException.php | Class | Class source |
Files | / | src | / | AppBundle | / | Model | / | Manager |
File | Role | Description |
---|---|---|
ImportUserManager.php | Class | Class source |
Files | / | src | / | AppBundle | / | Repository |
File | Role | Description |
---|---|---|
ImportUserRepository.php | Class | Class source |
Files | / | src | / | AppBundle | / | Resources | / | config |
File | Role | Description | ||
---|---|---|---|---|
doctrine (1 file) | ||||
services.yml | Data | Auxiliary data | ||
validation.yml | Data | Auxiliary data |
Files | / | src | / | AppBundle | / | Resources | / | config | / | doctrine |
File | Role | Description |
---|---|---|
ImportUser.orm.yml | Data | Auxiliary data |
Files | / | src | / | AppBundle | / | Service |
File | Role | Description |
---|---|---|
AgeStatistics.php | Class | Class source |
ImportCsvUser.php | Class | Class source |
Files | / | tests | / | AppBundle |
File | Role | Description | ||
---|---|---|---|---|
Command (2 files) | ||||
data (3 files) | ||||
Model (1 file, 2 directories) | ||||
Service (2 files) | ||||
BaseTest.php | Class | Class source |
Files | / | tests | / | AppBundle | / | Command |
File | Role | Description |
---|---|---|
UserAgeAverageCommandTest.php | Class | Class source |
UserImportCsvCommandTest.php | Class | Class source |
Files | / | tests | / | AppBundle | / | data |
File | Role | Description |
---|---|---|
user.full.fields.csv | Data | Auxiliary data |
user.full.with.comments.csv | Data | Auxiliary data |
user.headers.only.csv | Data | Auxiliary data |
Files | / | tests | / | AppBundle | / | Model |
File | Role | Description | ||
---|---|---|---|---|
Builder (1 file) | ||||
Csv (1 file, 1 directory) | ||||
ObjectManagerTest.php | Class | Class source |
Files | / | tests | / | AppBundle | / | Model | / | Builder |
File | Role | Description |
---|---|---|
ImportUserFactoryTest.php | Class | Class source |
Files | / | tests | / | AppBundle | / | Model | / | Csv |
File | Role | Description | ||
---|---|---|---|---|
Filter (1 file) | ||||
ReaderTest.php | Class | Class source |
Files | / | tests | / | AppBundle | / | Model | / | Csv | / | Filter |
File | Role | Description |
---|---|---|
CommentFilterTest.php | Class | Class source |
Files | / | tests | / | AppBundle | / | Service |
File | Role | Description |
---|---|---|
AgeStatisticsTest.php | Class | Class source |
ImportCsvUserTest.php | Class | Class source |
Files | / | web |
File | Role | Description |
---|---|---|
.htaccess | Data | Auxiliary data |
app.php | Example | Example script |
apple-touch-icon.png | Icon | Icon image |
app_dev.php | Example | Example script |
config.php | Example | Example script |
favicon.ico | Data | Auxiliary data |
robots.txt | Doc. | Documentation |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.